Saravanan Guest
|
Posted: Tue Apr 04, 2006 1:03 pm Post subject: MDI Child with no caption and flat border |
|
|
Hi,
I want a flat border MDI child window without any caption. I have tried
various combinations listed below
Tryout 1 :
=======
I changed the child form border style to bsNone and
void __fastcall TMDIChild::FormShow(TObject *Sender)
{
SetWindowLong(Handle, GWL_STYLE, GetWindowLong(Handle, GWL_STYLE) &
~WS_CAPTION ) ;
SetWindowPos(Handle, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE |
SWP_FRAMECHANGED);
}
void __fastcall TMDIChild::OnNCHitTest(TWMNCHitTest& Message)
{
DefaultHandler(&Message);
if ( Message.YPos - 3 < Top )
Message.Result = HTTOP ;
else if ( Message.YPos + 3 > Height + Top ) {
Message.Result = HTBOTTOM ;
}
if ( Message.XPos - 3 < Left ) {
Message.Result = HTLEFT ;
}
else if ( Message.XPos + 3 > Width + Left ) {
Message.Result = HTRIGHT ;
}
if ( Message.YPos - 3 < Top && Message.XPos - 3 < Left )
Message.Result = HTTOPLEFT ;
if ( Message.YPos + 3 > Height + Top && Message.XPos - 3 < Left )
Message.Result = HTBOTTOMLEFT ;
if ( Message.YPos - 3 < Top && Message.XPos + 3 > Width + Left )
Message.Result = HTTOPRIGHT ;
if ( Message.YPos + 3 > Height + Top && Message.XPos + 3 > Width + Left )
Message.Result = HTBOTTOMRIGHT ;
}
childform.h
void __fastcall OnNCHitTest(TWMNCHitTest& Message) ;
BEGIN_MESSAGE_MAP
VCL_MESSAGE_HANDLER(WM_NCHITTEST, TWMNCHitTest, OnNCHitTest)
END_MESSAGE_MAP(TForm)
I can able to resize the form using the HitTest and cursor appears properly
(Meaning resize cursor is displayed when mouse is moved over the border)
Problem : Border is not flat it is shows as 3d border
Tryout 2 :
=======
I changed the child form border style to bsSingle.
Now the Border Style is flat. Still i can able to resize the form using the
HitTest but cursor not appearing properly. (Meaning resize cursor is not
displayed when mouse is moved over the border)
Regards,
Saravanan A |
|