我想在OnPaint事件中啓用/禁用控件,但更改沒有得到反映。如果與其他應用程序更改撥動得到反映(使用ALT + TAB)禁用/啓用控制onPaint事件,但更改不反映
procedure TfrmBase.FormPaint(Sender: TObject);
var
...
...
begin
flg := False;
for i := ComponentCount - 1 downto 0 do
begin
Temp := Components[i];
if (Temp is TToolButton) then
begin
(Temp as TToolButton).Enabled := SomeFuncWhichReturnBoolean;
end
else if (Temp is TButton) then
(Temp as TButton).Enabled := SomeFuncWhichReturnBoolean ;
end;
end;
請建議
好線了所有的操作按鈕,所以現在你加入到新版本的標籤,對於那些間隔也是10兩年的版本。哪一個? – GolezTrol
使用'TActionList',定義一些動作並將動作連接到按鈕。每個動作都有一個「OnExecute」和「OnUpdate」事件 –
繪畫時不要改變狀態。真是個壞主意。 –