我有一个 TMachine 类,即 TShape 类
unit MachineShape;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, extctrls,myDataModule,Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TMachine = class(TShape)
private
{ Private declarations }
public
{ Public declarations }
procedure PlaceShape(sizeW,sizeH :integer; name, order,asset : string);
end;
implementation
Procedure TMachine.PlaceShape(sizeW,sizeH :integer; name, order,asset : string);
begin
self.width := sizeW;
self.height := sizeH;
self.top := 136;
self.left := MyDataModule.fDB.LastX +2;//set left
MyDataModule.fDB.lastx := left + sizeW;
end;
end.
我将如何为此添加 onmouseenter 代码?因此,当在运行时添加形状时,它会有自己的鼠标输入代码。像这样的东西,我知道这行不通..但也许它会告诉你我想要做什么?因此,当我创建 TMachine 时,我会将名称和编号传递给该程序,它会使 onmouseenter 程序使用我发送的名称/编号进行更新。
Procedure TMachine.EditMouseEnter(name,number :string);
begin
....onmouseenter(Label2.Caption := name AND label3.caption := Number)...
end