接管radiobutton onclick 事件

You can nil the OnClick event handler while changing a radiobutton state programmatically:

procedure TForm1.Button6Click(Sender: TObject);
var
  Save: TNotifyEvent;

begin
  Save:= RadioButton2.OnClick;
  RadioButton2.OnClick:= nil;
  RadioButton2.Checked:= not RadioButton2.Checked;
  RadioButton2.OnClick:= Save;
end;
posted @ 2015-12-23 23:09  老榕树  阅读(262)  评论(0编辑  收藏  举报