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 move wincontrols durning run time using the mouse 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
06-Sep-05
Category
System
Language
Delphi 4.x
Views
174
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
			1   
2   //This code shows how to move controls during runtime using the mouse
3   unit Unit1;
4   
5   interface
6   
7   uses
8     Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
9     Dialogs, ExtCtrls, StdCtrls;
10  
11  type
12    TForm1 = class(TForm)
13      Panel1: TPanel;
14      Edit1: TEdit;
15      Button1: TButton;
16      CheckBox1: TCheckBox;
17      ListBox1: TListBox;
18      RadioButton1: TRadioButton;
19      procedure Edit1MouseDown(Sender: TObject; Button: TMouseButton;
20        Shift: TShiftState; X, Y: Integer);
21    private
22      { Private declarations }
23    public
24      { Public declarations }
25    end;
26  
27  var
28    Form1: TForm1;
29  
30  implementation
31  
32  {$R *.dfm}
33  
34  procedure TForm1.Edit1MouseDown(Sender: TObject; Button: TMouseButton;
35    Shift: TShiftState; X, Y: Integer);
36  
37     const
38    SC_DragMove = $F012;
39  begin
40    ReleaseCapture;
41    TwinControl(sender).Perform(WM_SysCommand, SC_DRAGMOVE, 0);
42  end;
43  
44  end.


{*********************************DFM****************************************}
object Form1: TForm1
  Left = 192
  Top = 107
  Width = 870
  Height = 640
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object Panel1: TPanel
    Left = 432
    Top = 248
    Width = 185
    Height = 41
    Caption = 'Panel1'
    TabOrder = 0
    OnMouseDown = Edit1MouseDown
  end
  object Edit1: TEdit
    Left = 216
    Top = 152
    Width = 121
    Height = 21
    TabOrder = 1
    Text = 'Edit1'
    OnMouseDown = Edit1MouseDown
  end
  object Button1: TButton
    Left = 368
    Top = 48
    Width = 75
    Height = 25
    Caption = 'Button1'
    TabOrder = 2
    OnMouseDown = Edit1MouseDown
  end
  object CheckBox1: TCheckBox
    Left = 248
    Top = 56
    Width = 97
    Height = 17
    Caption = 'CheckBox1'
    TabOrder = 3
    OnMouseDown = Edit1MouseDown
  end
  object ListBox1: TListBox
    Left = 464
    Top = 24
    Width = 121
    Height = 97
    ItemHeight = 13
    TabOrder = 4
    OnMouseDown = Edit1MouseDown
  end
  object RadioButton1: TRadioButton
    Left = 432
    Top = 184
    Width = 113
    Height = 17
    Caption = 'RadioButton1'
    TabOrder = 5
    OnMouseDown = Edit1MouseDown
  end
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