Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to make a TPanel look like the title bar of a window Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
28-Oct-02
Category
VCL-Forms
Language
Delphi 2.x
Views
146
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

I have a good reason why I cannot use forms. So as an alternative I'm using two 
panels to mimic a simple form, i.e. with no windows icons (close, minimize etc.). 
One is aligned to the top to pose like the window title bar and the other to 
client. I want to paint the top panel like a typical title bar. How can I do this?

Answer:

There is an API function named DrawCaption, you can use it to draw the caption bar. 
Drop a client-aligned TPaintbox on your fake caption panel and do the drawing in 
the paintboxes OnPaint handler.
1   
2   procedure TPLabBaseChildform.CaptionPaint(Sender: TObject);
3   const
4     activeFlags: array[Boolean] of DWORD = (0, DC_ACTIVE);
5   begin
6     with Sender as TPaintbox do
7       DrawCaption(self.handle, canvas.handle, clientrect, activeFlags[FActive] or
8         DC_TEXT or DC_GRADIENT);
9   end;


To draw other elements as well (beside the icon, which DrawCaption can handle) you use DrawFrameControl instead.

			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC