M
micwolf
Unregistered / Unconfirmed
GUEST, unregistred user!
//自己定义了一个继承Tmemo的类(因为有些属性要设置),然后动态创建memo1控件然后使这个空间可以被拖动,为什么编译不过?请帮忙,立刻给分。
//编译提示错误在testmemo.MouseDown:=MyMouseDown;一行上
// [Error] main.pas(73): Not enough actual parameters
// [Error] main.pas(73): Not enough actual parameters
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TMymemo = class(TMemo)
private
{ Private declarations }
public
{ Public declarations }
end;
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
procedure MyMouseDown(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);
{ Public declarations }
end;
var
Form1: TForm1;
testmemo:TMymemo;
const SC_DRAGMOVE = $F017;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
testmemo:=TMymemo.Create(self);
testmemo.Parent:=self;
testmemo.MouseDown:=MyMouseDown;
end;
procedure TForm1.MyMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
TWinControl(Sender).Perform(wm_syscommand, sc_dragmove, 0);
end;
end.
//编译提示错误在testmemo.MouseDown:=MyMouseDown;一行上
// [Error] main.pas(73): Not enough actual parameters
// [Error] main.pas(73): Not enough actual parameters
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TMymemo = class(TMemo)
private
{ Private declarations }
public
{ Public declarations }
end;
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
procedure MyMouseDown(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);
{ Public declarations }
end;
var
Form1: TForm1;
testmemo:TMymemo;
const SC_DRAGMOVE = $F017;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
testmemo:=TMymemo.Create(self);
testmemo.Parent:=self;
testmemo.MouseDown:=MyMouseDown;
end;
procedure TForm1.MyMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
TWinControl(Sender).Perform(wm_syscommand, sc_dragmove, 0);
end;
end.