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 hide and show the title bar of a TForm 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
156
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

How to hide and show the title bar of a TForm

Answer:

Here is how to hide the titlebar:

1   procedure TYourFormName.HideTitlebar;
2   var
3     Save: LongInt;
4   begin
5     if BorderStyle = bsNone then
6       Exit;
7     Save := GetWindowLong(Handle, GWL_STYLE);
8     if (Save and WS_CAPTION) = WS_CAPTION then
9     begin
10      case BorderStyle of
11        bsSingle, bsSizeable:
12          SetWindowLong(Handle, GWL_STYLE, Save and (not (WS_CAPTION)) or WS_BORDER);
13        bsDialog:
14          SetWindowLong(Handle, GWL_STYLE, Save and (not (WS_CAPTION)) or 
15  DS_MODALFRAME
16            or WS_DLGFRAME);
17      end;
18      Height := Height - GetSystemMetrics(SM_CYCAPTION);
19      Refresh;
20    end;
21  end;
22  
23  //And here is how we show it again:
24  
25  procedure TYourFormName.ShowTitlebar;
26  var
27    Save: LongInt;
28  begin
29    if BorderStyle = bsNone then
30      Exit;
31    Save := GetWindowLong(Handle, GWL_STYLE);
32    if (Save and WS_CAPTION) <> WS_CAPTION then
33    begin
34      case BorderStyle of
35        bsSingle, bsSizeable:
36          SetWindowLong(Handle, GWL_STYLE, Save or WS_CAPTION or WS_BORDER);
37        bsDialog:
38          SetWindowLong(Handle, GWL_STYLE, Save or WS_CAPTION or DS_MODALFRAME or
39            WS_DLGFRAME);
40      end;
41      Height := Height + GetSystemMetrics(SM_CYCAPTION);
42      Refresh;
43    end;
44  end;


			
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