Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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???

Visit http://www.nico.gotdns.com

 

Now ONLINE!

Guest TheIrishCoder
Posted
Do you mean custom shaped forms? If so there I can give you some code to do that if you wish.
Posted

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.

Visit http://www.nico.gotdns.com

 

Now ONLINE!

Guest TheIrishCoder
Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...