如何在delphi中禁用和启用按钮

时间:2017-09-14 10:09:06

标签: delphi button

如何在delphi中禁用和启用按钮

这是我的代码

procedure Tfrm_color_demo.btn_purpleClick(Sender: TObject);
begin
  frm_color_demo.color := clpurple;
  frm_color_demo.caption := 'purple';
  #disable btn_purple enable btn_yellow  
end;

procedure Tfrm_color_demo.btn_yellowClick(Sender: TObject);
begin
  frm_color_demo.color := clyellow;
  frm_color_demo.caption := 'yellow';
#disable btn_yellow  enable btn_purple 
end;

end.

1 个答案:

答案 0 :(得分:3)

为您选择的控件设置Enabled属性。例如,禁用按钮:

Button1.Enabled := False;

启用:

Button1.Enabled := True;