🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #4029

MDI Child with no caption and flat border

#4029
From: Saravanan
Date: Wed, 05 Apr 2006 06:19
76 lines
3022 bytes
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)

Note : One more observation, when the FormStyle is fsNormal, Tryout1 works
well.  But i want the formStyle as fsMDIChild

Regards,
Saravanan A
Technical Details
Message-ID: <4433616e@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!news.glorb.com!news-out2.kabelfoon.nl!newsfeed.kabelfoon.nl!bandi.nntp.kabelfoon.nl!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,96199be6569716d2,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Saravanan" <asaravanan@ften.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: MDI Child with no caption and flat border
Date: Wed, 5 Apr 2006 11:49:27 +0530
Lines: 78
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 203.199.207.189
Message-ID: <4433616e@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1144217966 203.199.207.189 (4 Apr 2006 23:19:26 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!news.glorb.com!news-out2.kabelfoon.nl!newsfeed.kabelfoon.nl!bandi.nntp.kabelfoon.nl!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail