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 tell if a TPanel is moved outside the visible part 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
26-Aug-02
Category
VCL-Forms
Language
Delphi 2.x
Views
70
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

I use SC_DRAGMOVE so I can drag a TPanel around a form. Now, how do I tell the form 
when the panel is outside the form and the form should add some scrollbars?

Answer:

1   unit Unit1;
2   
3   interface
4   
5   uses
6     Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
7     Dialogs, ComCtrls, StdCtrls, ExtCtrls;
8   
9   type
10    TPanel = class(ExtCtrls.TPanel)
11    private
12      procedure WMExitSizeMove(var message: TMessage); message WM_EXITSIZEMOVE;
13    end;
14  
15    TForm1 = class(TForm)
16      StatusBar: TStatusBar;
17      Button1: TButton;
18      OpenDialog1: TOpenDialog;
19      Label1: TLabel;
20      ComboBox1: TComboBox;
21      CheckBox1: TCheckBox;
22      Panel1: TPanel;
23      procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton;
24        Shift: TShiftState; X, Y: Integer);
25    private
26      { Private declarations }
27    public
28      { Public declarations }
29    end;
30  
31  var
32    Form1: TForm1;
33  
34  implementation
35  
36  {$R *.DFM}
37  
38  procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
39    Shift: TShiftState; X, Y: Integer);
40  const
41    SC_DRAGMOVE = $F012;
42  begin
43    Mouse.Capture := 0;
44    sendmessage(panel1.handle, WM_SYSCOMMAND, SC_DRAGMOVE, 0);
45  end;
46  
47  { TPanel }
48  
49  procedure TPanel.WMExitSizeMove(var message: TMessage);
50  begin
51    Left := Left + 1;
52    Left := Left - 1;
53  end;
54  
55  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