Problems creating a custom shaped MDI Child Form

R

Roger.Smith

I have just created an MDI project in VB.NET. I was trying to enhance the
looks of a form by making it have a unique shape. I followed the directions
from a MSDN article that uses a bitmap for the background, removes the title
bar, and sets a transparency color (thus allowing a custom shape for the
form). The article that I followed was:

Shaped Windows Forms and Controls in Visual Studio .NET
http://msdn.microsoft.com/library/d...apedWindowsFormsControlsInVisualStudioNET.asp

The problem is that when I open the form as a child of the MDI form, it does
not appear to have the custom shape that is defined. What I see is the
rectangular bitmap image, with the transparent color displayed. Basically,
it appears as if the TransparencyKey property is not working. However, when
I open the form from the MDI form, not assigning the MdiParent property, the
form open with the custom shape. The code that I use to open the form is
(menu item click event):

Dim frmchild As New frmCustomShape
With frmchild
.MdiParent = Me 'comment this out to allow the custom shape to be
applied.
.Show()
End With
Is the ability to crate a custom shaped form limited to non-MdiChild forms?
Is there a reason that this is happening? Is there a workaround? I have
tried searching the MSDN and Google, but have had no success in locating any
supporting information. Can anyone tell me what is going on or where to
look for solutions?

Thanks,

Roger
 
C

Chris

Try setting the region property for your form instead. That will
actually change the form's shape.

here's an article that tells how to take a bitmap with an irregular
shape and create a region out of it. You can then assign this region
to the form's region property.
http://www.bobpowell.net/region_from_bitmap.htm

Chris
 
R

Roger.Smith

Thanks Chris. The website is very informative. I should be able to adapt
this methodology to my project.

Roger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top