S
savenight
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
end;
var
Form1: TForm1;
c:tcontrol;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
a:tpoint;
begin
getcursorpos(a);
a:=screentoclient(a);
a.x:=a.X +1;
a.Y :=a.Y+1;
[gold]c:=form1.ControlAtPos(a,false,false);[/gold]
[red]c.refresh;[/red] 出错
end;
end.
-----------------------------------------------
[gold]c:=form1.ControlAtPos(a,false,false);[/gold]
这一行其实没有得到所要的TCONTROL,即 c为NIL.
我意图是动态移动form上任意控件.
[?]
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
end;
var
Form1: TForm1;
c:tcontrol;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
a:tpoint;
begin
getcursorpos(a);
a:=screentoclient(a);
a.x:=a.X +1;
a.Y :=a.Y+1;
[gold]c:=form1.ControlAtPos(a,false,false);[/gold]
[red]c.refresh;[/red] 出错
end;
end.
-----------------------------------------------
[gold]c:=form1.ControlAtPos(a,false,false);[/gold]
这一行其实没有得到所要的TCONTROL,即 c为NIL.
我意图是动态移动form上任意控件.
[?]