对于在程序运行过程中,在窗体的panel上动态创建的Label,如何对它们进行拖放(自由移动)。
解决方案 »
- delphi中label
- 用Delphi开发的ISAPI如何在IIS7下配置运行?
- 救命啊,很奇怪的[Pascal Error .......]
- 如何从文本文件中读出数据库?
- 请问Primary key 与 unique index 有什么区别啊
- 同样的程序在单位可以运行,但在家里就提示找不到这个文件planner.res
- 请问如果把BDE数据库中的记录排序...谢谢
- 多年收集1000多条delphi技巧代码,加浏览器(原创)
- 如何在delphi中让一个字符串等于长度为n的全部由某个字符组成?
- 如何减少重复劳动?
- 如何将TMemoryStream内容传给TImage,并且不用先保存到硬盘在读取?
- 紧急求救!??
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if (Button = mbLeft) then
begin
ReleaseCapture;
SendMessage((Sender as TStaticText).Handle, WM_SYSCOMMAND, SC_MOVE or 2, 0);
end;
end;
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
StaticText1: TStaticText;
procedure StaticText1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.StaticText1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if (Button = mbLeft) then
begin
ReleaseCapture;
SendMessage((Sender as TStaticText).Handle, WM_SYSCOMMAND, SC_MOVE or 2, 0);
end;
end;procedure TForm1.Button1Click(Sender: TObject);
var
TT: TStaticText;
begin
TT := TStaticText.Create(Application);
TT.Caption := 'Test';
TT.Parent := Form1;
TT.OnMouseDown := StaticText1MouseDown;
end;end.
statictext的caption呢,我是这样用SendMessage(sthandle(stn),WM_SETTEXT,Memo1.Lines.Text,0);可是会报错,对于每个StaticText起个不同的名字,来保存的话要用指针数组吧,有这样的例子不?
wParam = 0; // not used; must be zero
lParam = (LPARAM)(LPCTSTR)lpsz; // address of window-text string