unit2.~pas

来自「使用canvas组件写的可拖拽东西使用canvas组件写的可拖拽东西使用canv」· ~PAS 代码 · 共 51 行

~PAS
51 行
字号
unit Unit2;
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, ExtCtrls, Menus, StdCtrls, jpeg;
const
  MACHINE_TYPE_S1='s1';
  MACHINE_PORT_P1='p1';
type
  TMachine = class
    image:TImage;
    mtype:integer;
    x:integer;
    y:integer;
    width:integer;
    height:integer;
    private
    public
      procedure drawImage(canvas:TCanvas);
  end;
  TMachineManage = class
    private
      machine:TMachine;
      currentMachine:TMachine;
    public
      procedure drawImage(canvas:TCanvas);
      procedure addMachine(vmachine:TMachine);
  end;

implementation
//添加设备到链表中
procedure TMachineManage.addMachine(vmachine:TMachine);
begin
  if(currentMachine=nil) then
    begin
      currentMachine:=vmachine;
      machine:=vmachine;
    end;
end;
//设备管理类的画图方法
procedure TMachineManage.drawImage(canvas:TCanvas);
begin
  machine.drawImage(canvas);
end;
//设备类的画图方法
procedure TMachine.drawImage(canvas:TCanvas);
begin
  canvas.Draw(x,y,image.Picture.Graphic);
end;

end.
 

⌨️ 快捷键说明

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