🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Change menu background

#9821
From: Oren Halvani
Date: Wed, 09 Jun 2004 17:24
36 lines
1970 bytes
hi Sam,

put a panel on the form set it to a custom color and try the following
it's for TStaticText but maybe could work also with TMainMenu...
just try it out...


Oren
/*********************************************************/
// earsing background...in form declaration

protected: void __fastcall OnWmCtlColorStatic(TWMCtlColorStatic &Message);

BEGIN_MESSAGE_MAP
      VCL_MESSAGE_HANDLER(WM_CTLCOLORSTATIC, TWMCtlColorStatic,
OnWmCtlColorStatic)
END_MESSAGE_MAP(TForm)

// in form definition .cpp
void __fastcall TForm1::OnWmCtlColorStatic(TWMCtlColorStatic &Message)
{
  if(Message.ChildWnd == StaticText1->Handle)
    {
      SetBkMode(Message.ChildDC, TRANSPARENT);
      Message.Result = (long)GetStockObject(NULL_BRUSH);
    }
  else TForm::Dispatch(&Message);
}

__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner)
{
  HWND statichwnd = StaticText1->Handle;
  long exstyle = GetWindowLong(statichwnd, GWL_EXSTYLE);
  exstyle = exstyle | WS_EX_TRANSPARENT;
  SetWindowLong(statichwnd, GWL_EXSTYLE, exstyle);
}
Technical Details
Message-ID: <40c74788@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40c709ba$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,7f556f554d7ea25b
X-Google-Attributes: gid10cc67,public
Reply-To: "Oren Halvani" <NoSpam@fdtd.com>
From: "Oren Halvani" <NoSpam@fdtd.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <40c709ba$1@newsgroups.borland.com>
Subject: Re: Change menu background
Date: Wed, 9 Jun 2004 19:24:33 +0200
Lines: 38
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 217.234.87.217
Message-ID: <40c74788@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1086801800 217.234.87.217 (9 Jun 2004 10:23:20 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail