procedure TForm1.FormCreate(Sender: TObject);
begin
if (csClickEvents in Button1.ControlStyle) then
Button1.ControlStyle:=Button1.ControlStyle-[csClickEvents];
end;procedure TForm1.Button1Click(Sender: TObject);
begin
label1.Caption:=label1.Caption+ 'hello';
end;这样应该可以在消息处理的时候忽略click函数了,可是结果button1click还是执行了,请教为 什么?
begin
if (csClickEvents in Button1.ControlStyle) then
Button1.ControlStyle:=Button1.ControlStyle-[csClickEvents];
end;procedure TForm1.Button1Click(Sender: TObject);
begin
label1.Caption:=label1.Caption+ 'hello';
end;这样应该可以在消息处理的时候忽略click函数了,可是结果button1click还是执行了,请教为 什么?
begin
exit;
end;
begin
if Message.NotifyCode = BN_CLICKED then Click;
end;在TControl中确实没让他响应,取作用的代码:procedure TControl.WMLButtonDown(var Message: TWMLButtonDown);
begin
SendCancelMode(Self);
inherited;
if csCaptureMouse in ControlStyle then MouseCapture := True;
if csClickEvents in ControlStyle then Include(FControlState, csClicked);
DoMouseDown(Message, mbLeft, []);
end;procedure TControl.WMLButtonUp(var Message: TWMLButtonUp);
begin
inherited;
if csCaptureMouse in ControlStyle then MouseCapture := False;
if csClicked in ControlState then
begin
Exclude(FControlState, csClicked);
if PtInRect(ClientRect, SmallPointToPoint(Message.Pos)) then Click;
end;
DoMouseUp(Message, mbLeft);
end;