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 create a floating toolbar 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
03-Sep-02
Category
Win API
Language
Delphi 2.x
Views
81
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas 

Floating toolbar

Answer:

All you have to do is handle Windows' wm_NCHitTest message. 
(Compare to the tip how to drag a window without a caption bar. It's the same 
technique.) 


1   unit Dragmain;
2   
3   interface
4   
5   uses
6     SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
7     Forms, Dialogs, StdCtrls;
8   
9   type
10    TForm1 = class(TForm)
11      Button1: TButton;
12      procedure Button1Click(Sender: TObject);
13    private
14      procedure WMNCHitTest(var M: TWMNCHitTest); message wm_NCHitTest;
15    end;
16  
17  var
18    Form1: TForm1;
19  
20  implementation
21  
22  {$R *.DFM}
23  
24  procedure TForm1.WMNCHitTest(var M: TWMNCHitTest);
25  begin
26    inherited; { call the inherited message handler }
27    if M.Result = htClient then { is the click in the client area?   }
28      M.Result := htCaption; { if so, make Windows think it's     }
29    { on the caption bar.                }
30  end;
31  
32  procedure TForm1.Button1Click(Sender: TObject);
33  begin
34    Close;
35  end;
36  
37  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