-
Jun 24th, 2011, 05:38 AM
#1
Thread Starter
Addicted Member
[RESOLVED] Transparent MDI-Parent?
I know you can make certain parts of a form transparent by setting the transparencyKey of the form to the color of your choice.
vb.net Code:
Me.MdiParent.TransparencyKey = Color.Fuchsia
Me.BackColor = Color.Fuchsia
Once I set the form to be a MDI Container, it seems to just ignore that function.
On my MDI Container form I have a menu and that is the only thing I want displayed. I want the container itself to be transparent. The forms that get loaded into the mdicontainer will be shown normal.
How can I do this?
-
Jun 24th, 2011, 08:43 AM
#2
Hyperactive Member
Re: Transparent MDI-Parent?
Hiya, the simplest approach, which I guess would be considered more of a Hack than a plausible solution, would be to do something like the following (I don't know what effect that will have on your Menu though):
VB.NET Code:
'Create an MDIClient
Private MyMDIClient As New MdiClient
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Set the BackColor and Transparency Key for your form
Me.BackColor = Color.Red
Me.TransparencyKey = Me.BackColor
'Add the MDIClient to your form and set its backcolor to match your form backcolor
MyMDIClient.BackColor = Color.Red
Me.Controls.Add(MyMDIClient)
'Use Form1 as your MdiParent instead of the MDIClient
Dim f2 As New Form2
f2.MdiParent = Me
f2.Show()
End Sub
It may be possible to implement a more solid solution by creating your MDIClient by using the CreateWindowEx API. I've had a look over a few articles that point you towards creating an MDIClient but it is a pretty complex road to go down. If you would like to look further into it, here are a few articles that may help:
http://www.pinvoke.net/default.aspx/...ex.html?diff=y
http://www.experts-exchange.com/Prog..._24264982.html - Subscription Required to view solutions.
http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
http://www.pinvoke.net/default.aspx/....getwindowlong - List of WindowStyle and ExtendedWindowStyle Constants
Good luck and hope this helps
-
Jun 28th, 2011, 02:58 AM
#3
Thread Starter
Addicted Member
Re: [RESOLVED] Transparent MDI-Parent?
Thanks a lot for the code. I kinda feel stupid now seeing how easy this issue was to solve...
Thanks again
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|