Article View: borland.public.cppbuilder.nativeapi
Article #3948Re: MDI Child with no caption and flat border
From: JD
Date: Thu, 06 Apr 2006 17:47
Date: Thu, 06 Apr 2006 17:47
53 lines
2626 bytes
2626 bytes
"Saravanan" <asaravanan@ften.com> wrote:
>
<snip>
> SetWindowLong(Handle, GWL_STYLE, GetWindowLong(Handle, GWL_STYLE) & ~WS_CAPTION ) ;
You should be overriding the CreateParams method for this
and if you intercept WM_NCPAINT, you can draw a flat border
so you don't have to mimic default behavior with resizing.
For example:
protected:
virtual void __fastcall CreateParams( TCreateParams &Params );
private: // User declarations
MESSAGE void __fastcall WMNCPaint( TMessage &Message );
public: // User declarations
BEGIN_MESSAGE_MAP
VCL_MESSAGE_HANDLER( WM_NCPAINT, TMessage, WMNCPaint )
END_MESSAGE_MAP( TForm )
#include <memory>
//-------------------------------------------------------------
void __fastcall TForm2::CreateParams( TCreateParams &Params )
{
TForm::CreateParams( Params );
Params.Style = Params.Style & ~WS_CAPTION;
}
//-------------------------------------------------------------
MESSAGE void __fastcall TForm2::WMNCPaint(TMessage &Message)
{
TForm::Dispatch( &Message );
std::auto_ptr<TCanvas> pCanvas ( new TCanvas );
pCanvas->Handle = ::GetWindowDC( Handle );
TRect R;
::GetWindowRect( Handle, &R );
int width = R.Right - R.Left,
height = R.Bottom - R.Top,
Limit = ::GetSystemMetrics( SM_CXDLGFRAME );
for( int x = 0; x < Limit; ++x )
{
pCanvas->Pen->Color = pCanvas->Pixels[ width - 1 - x ][ height - 1 - x ];
pCanvas->MoveTo( x, height - 2 - x );
pCanvas->LineTo( x, x );
pCanvas->LineTo( width - x, x );
}
::ReleaseDC( Handle, pCanvas->Handle );
}
//-------------------------------------------------------------
~ JD
Technical Details
Message-ID:
<44355444$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4433616e@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,96199be6569716d2 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "JD" <nospam@nospam.com> Sender: "JD" <nospam@nospam.com> Reply-To: "JD" <nospam@nospam.com> Subject: Re: MDI Child with no caption and flat border Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 152.163.100.201 X-Forwarded-For: 172.149.226.24 References: <4433616e@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <44355444$1@newsgroups.borland.com> Date: 6 Apr 2006 10:47:48 -0700 X-Trace: newsgroups.borland.com 1144345668 207.105.83.66 (6 Apr 2006 10:47:48 -0700) Lines: 54 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail