Windows Develop Bookmark and Share   
 index > Windows Forms General > Using CreateParams with MDI Child
 

Using CreateParams with MDI Child

I am attempting to override CreateParams in an MDI child. The MSDN documentation states that to successfully do this you have to reference ClientCreateStruct. However, I cannot find any code samples for doing this. Can somone share with me the code for overriding CreateParams in an MDI child form?

DavidAnderson  Tuesday, December 02, 2008 4:03 PM
That's not going to work. Drop shadows are created by a video overlay. These overlays only work on overlapped windows, not child windows. The TransparencyKey and Opacity properties don't work either, for the same reason.
nobugz  Tuesday, December 02, 2008 8:09 PM
DavidAnderson wrote:

I am attempting to override CreateParams in an MDI child. The MSDN documentation states that to successfully do this you have to reference ClientCreateStruct. However, I cannot find any code samples for doing this. Can somone share with me the code for overriding CreateParams in an MDI child form?

Post the link that you are referring to.

Rudedog2  Tuesday, December 02, 2008 4:41 PM
The CLIENTCREATESTRUCT contains the handle of a MDI applications main menu and the id of the first MDI child. Its pointer is used as the lpParam of the CreateWindow and CreateWindowEx functions.
You should not care about it as long as you are using the base classes CreateParams; ie:

CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x20;
return cp;
KomplexoR  Tuesday, December 02, 2008 5:09 PM
DavidAnderson  Tuesday, December 02, 2008 7:21 PM

This is the code I am using. When attached to the parent, it creates a shadow. When attached to a child, it does not work:

Code Snippet

private const int CS_DROPSHADOW = 0x00020000;

public Preferences()

{

InitializeComponent();

comboRowsPerPage.SelectedIndex = 0;

}

protected override CreateParams CreateParams

{

get

{

CreateParams p = base.CreateParams;

p.ClassStyle = p.ClassStyle | CS_DROPSHADOW;

return p;

}

}

DavidAnderson  Tuesday, December 02, 2008 7:24 PM
That's not going to work. Drop shadows are created by a video overlay. These overlays only work on overlapped windows, not child windows. The TransparencyKey and Opacity properties don't work either, for the same reason.
nobugz  Tuesday, December 02, 2008 8:09 PM

Are there any options?

DavidAnderson  Tuesday, December 02, 2008 8:14 PM
David,

Did you find a solution ?, seems like just you and me have this problem.

I have found a component with source code that does it with modal forms, I made it work, but when moving th mdichild to the parent form's border, tha shadow appears outside the parent form:

Dropshadow Component
http://insystusa.com/Products.aspx

Could youprovide me some feedback ?

Thanks in advance.


George Waters  Friday, September 18, 2009 10:26 PM

You can use google to search for other answers

Custom Search

More Threads

• MSAA accDoDefaultAction not working for form menu items
• Delete file to recycle bin.
• Accesing main form from a sub form
• Winform TabStrip control
• Open directory with C#
• I want to list the Directories in TreeView.......
• Programatically resize a datagridview
• Application.Run vs Form.Show?
• How to get IME Input String and Composited Words with C#
• windows messages and top-level forms