02-20-2004, 01:47 AM
Need help in creating custom shape form.
I have a background image that I have added and I would like my form to follow the shape of the image instead just the square look provided.
Can anyone help??
Thanks in advance...
02-20-2004, 01:51 AM
I forgot to mentioned that I would like to do that in VB.Net environment.
04-12-2008, 01:27 AM
There are two ways to do it, TransperancyKey and Region.
These articles are in C#.Net unfortunately but seems like they would be a breeze to write in VB.Net:
04-12-2008, 08:10 AM
The summary of either article is as follows:
If your form shape is very irregular, make sure the areas of the image that you don't want to show up are the same color and set the form's TransparencyKey property. When the form runs, those areas will be transparent.
If the shape is relatively simple, consider creating a region out of the shape; I believe the easiest way is to define the shape using the GraphicsPath class and use the Region constructor that takes a GraphicsPath as a parameter. Then, set the form's Region property to the region.
You might also have to change the form's FormBorderStyle property to None; keep in mind this means you will be responsible for writing code to move or close your form. Furthermore, shaped forms go against all of the UI training that a consistent Windows interface provides to the user, so be sure that you really need a shaped form.