If you really want to customize the appearance of title bar of mdiChild Window, it seems you need handle painting of non-client areas of child window by handling WM_NCPAINT
message.
Also you need to handle messages like WM_SETCURSOR
, WM_MOUSEMOVE
, WM_NCLBUTTONDOWN
, ... .
As a workaround you can use a panel instead of mdiParent.
- Create parent form and don't set
IsMdiContainer
.
- Add a panel to your parent form and name it "ContainerPanel" and set its
Dock
property to fill.
- Create your child form and add it to panel with none border style, no control box, fill dock style and non top level.
Here is sample code:
var f = new ChildForm();
f.TopLevel = false;
f.ControlBox = false;
f.Dock = DockStyle.Fill;
f.BorderStyle = System.Windows.Forms.BorderStyle.None;
/*I assume this code is in your ParentForm and so 'this' points to ParentForm that contains ContainerPanel*/
this.ContainerPanel.Controls.Add(f);
f.Show();
Using such method you can control every aspect of your hand made mdi window. For example you can use a Menu to show list of open windows and a toolstrip to close windows.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…