鼠标移动控件-自动.txt

来自「学习Delphi最好的教材。通过一个个简单而实用的实例」· 文本 代码 · 共 14 行

TXT
14
字号
再增加一个几何(Shape)控件
把定时器事件的代码改为
procedure TForm1.Timer1Timer(Sender: TObject);
begin
  if Label1.Caption='向上' then
    Shape1.Top:=Shape1.Top-5;
  if Label1.Caption='向左' then
    Shape1.Left:=Shape1.Left-5;
  if Label1.Caption='向下' then
    Shape1.Top:=Shape1.Top+5;
  if Label1.Caption='向右' then
    Shape1.Left:=Shape1.Left+5;
end;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?