M milesmaqi Unregistered / Unconfirmed GUEST, unregistred user! 2002-05-29 #1 假设现在有EDI控件多个,控件得到焦点时背景色为红色, 失去焦点时背景色还原为CLWINDOW 用来突出焦点所在位置。
L li_zhifu Unregistered / Unconfirmed GUEST, unregistred user! 2002-05-29 #2 将所有的TEdit的OnEnter事件都指向同一处代码 procedure TForm1.Edit1Enter(Sender: TObject); begin (Sender as TEdit).Color:=clRed; end; 同理,所有TEdit的OnExit procedure TForm1.Edit1Exit(Sender: TObject); begin (Sender as TEdit).Color:=clWhite; end;
将所有的TEdit的OnEnter事件都指向同一处代码 procedure TForm1.Edit1Enter(Sender: TObject); begin (Sender as TEdit).Color:=clRed; end; 同理,所有TEdit的OnExit procedure TForm1.Edit1Exit(Sender: TObject); begin (Sender as TEdit).Color:=clWhite; end;
雪 雪中漫步 Unregistered / Unconfirmed GUEST, unregistred user! 2002-05-29 #3 在edit的onenter事件中 if (sender is tedit) then if (sender as tedit).focused then (sender as tedit).color:=clred else (sender as tedit).color:=clwindow;
在edit的onenter事件中 if (sender is tedit) then if (sender as tedit).focused then (sender as tedit).color:=clred else (sender as tedit).color:=clwindow;
C cxg8888 Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-21 #5 如果是控件,请截获WM_SetFocus和WM_KillFocus消息。