K
kusanagi
Unregistered / Unconfirmed
GUEST, unregistred user!
分在这里,奇怪为什么一个问题无答案还一定要给分?
http://www.delphibbs.com/delphibbs/dispq.asp?lid=1388259
问题:
ttestbutton= class(tbutton)
public
procedure mousemove(var Message: TWMMouseMove)
message WM_MOUSEMOVE;
end;
procedure ttestbutton.mousemove(var Message: TWMMouseMove);
begin
caption:= 'move1';
inherited
//////////就是这里
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
sendmessage(TButton(FindComponent('button2')).Handle, WM_MOUSEMOVE, 0 , 0);
end;
procedure TForm1.FormCreate(Sender: TObject);
var
button2: ttestbutton;
begin
button2:= ttestbutton.create(self);
button2.name:= 'button2';
button2.Parent:= self;
button2.Width:= 100;
button2.Height:= 40;
button2.OnMouseMove:= button1mousemove;
end;
procedure TForm1.Button1MouseMove(Sender: TObject
Shift: TShiftState
X,
Y: Integer);
begin
tbutton(sender).caption:= 'move2';
end;
结果button1点了之后button2的caption为move2,难道inherited把WM_MOUSEMOVE消息继续往夫类传递了???
http://www.delphibbs.com/delphibbs/dispq.asp?lid=1388259
问题:
ttestbutton= class(tbutton)
public
procedure mousemove(var Message: TWMMouseMove)
message WM_MOUSEMOVE;
end;
procedure ttestbutton.mousemove(var Message: TWMMouseMove);
begin
caption:= 'move1';
inherited
//////////就是这里
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
sendmessage(TButton(FindComponent('button2')).Handle, WM_MOUSEMOVE, 0 , 0);
end;
procedure TForm1.FormCreate(Sender: TObject);
var
button2: ttestbutton;
begin
button2:= ttestbutton.create(self);
button2.name:= 'button2';
button2.Parent:= self;
button2.Width:= 100;
button2.Height:= 40;
button2.OnMouseMove:= button1mousemove;
end;
procedure TForm1.Button1MouseMove(Sender: TObject
Shift: TShiftState
X,
Y: Integer);
begin
tbutton(sender).caption:= 'move2';
end;
结果button1点了之后button2的caption为move2,难道inherited把WM_MOUSEMOVE消息继续往夫类传递了???