Example of custom forms

NicoVB

Centurion
Joined
Jan 2, 2002
Messages
160
Location
Belgium
Does anyone know where you can find examples of custom designed forms that do not look like normal forms in .NET. (an example: MSN explorer windows have a special look).

Do you have to inherit from the Form object, but what then???
 
Do you mean custom shaped forms? If so there I can give you some code to do that if you wish.
 
Yes, I mean custom shaped forms. But with a selfmade titlebar. An other buttons for hiding, resizing and exiting the form.

But the problem I have, is that when you set the formborderstyle from the form to: None, you have problems with resizing your form!!!. And that is not so very good.
 
Well the best way to create a shaped form is to use a bitmap or draw a shape with a graphics object, and set the rest of the form a uniform color set to transparent and as you say setting the formborderstyle to none. You can subclass the form to make windows think you are clicking on the titlebar when actually clicking on the form so that it can moved. You do this by overiding the WndProc method of the form class:-

Protected Overides Sub WndProc(ByRef m As Message)
MyBase.WndProc(m)
If m.Msg = WM_NCHITTEST then
If m.Result.ToInt32 = HTCLIENT then
m.Result = New IntPtr(HTCAPTION)
End If
End If
End Sub

Now clicking anywhere on the form allows you to move it. I'm sure there is a way of implementing resizing but I'm not aware how to do it but quite often with a shaped form you might just not allow it to be resized. If you discover how to implement it you will have to resize the bitmap/graphics object at the same time.
 
Okay, thanks for this information, and i'll keep search for the resizing thing. But I think it should work with the MouseDown and MouseMove event.
 
You'd be better advised to use TheIrishCoders method, rather than MouseMove etc events. Let Windows do its own moving.
 
Okay, but does this solve also the problem for really resizing the window by pulling in the corner of the form??

I thought TheIrishCoder only find a solution for the problem with the titlebar..

??
 
That's right. I don't know how you'd use Windows resizing since you turned off the borders. You might have to do it manually.
 
Back
Top