Board index » cppbuilder » MDI Child and BorderStyle...

MDI Child and BorderStyle...


2003-10-17 09:38:36 PM
cppbuilder1
Hi all,
My project consists in an MDI application. I would like that my MDI children
forms do NOT HAVE borders. So I tried to put bsNone to BorderStyle. It seems
that BorderStyle is set to bsSizeable in TCustomForm.CreateParams ("Forms.pas")
when the form is a MDI Children.
So, is there a way to have MDI Children with no border (not sizeable and not
moveable) ?
Thanks by advance,
Nicolas
 
 

Re:MDI Child and BorderStyle...

Nicolas,
Quote
So, is there a way to have MDI Children with no border
(not sizeable and not moveable) ?
Augment the CreateParams() method and remove the WS_CAPTION and
WS_THICKFRAME styles...
class TMDIChild : public TForm
{
// ...
protected:
virtual void __fastcall CreateParams(TCreateParams& Params)
{
TForm::CreateParams(Params);
Params.Style &= ~(WS_CAPTION | WS_THICKFRAME);
}
};
HTH,
Damon (TeamB)
 

Re:MDI Child and BorderStyle...

"Damon Chandler (TeamB)" < XXXX@XXXXX.COM >wrote in message news: XXXX@XXXXX.COM ...
I want a MDIChild with a caption, resizeable and WS_EX_CLIENTEDGE, how do you do that?
Todd
 

{smallsort}

Re:MDI Child and BorderStyle...

Thanks a lot, it works fine,
Nicolas.
 

Re:MDI Child and BorderStyle...

Todd,
Quote
I want a MDIChild with a caption, resizeable and
WS_EX_CLIENTEDGE, how do you do that?
You'll need to modify the extended style of the window via the
SetWindowLong() function (this is required because MDI children are created
via the WM_MDICREATE message whose associated MDICREATESTRUCT data doesn't
contain an extended-style field). You can call SetWindowLong() from within
an augmented CreateWindowHandle(), like so...
class TMDIChild : public TForm
{
//...
protected:
virtual void __fastcall CreateWindowHandle(
TCreateParams const& Params)
{
TForm::CreateWindowHandle(Params);
SetWindowLong(
WindowHandle, GWL_EXSTYLE,
GetWindowLong(WindowHandle, GWL_EXSTYLE) |
WS_EX_CLIENTEDGE
);
}
};
Good luck,
Damon (TeamB)