線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:804
推到 Plurk!
推到 Facebook!

TEdit 問題..

答題得分者是:jest0024
jslucky
一般會員


發表:4
回覆:8
積分:2
註冊:2002-03-13

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-03-24 22:55:43 IP:211.72.xxx.xxx 未訂閱
假設我有3個 edit 元件在 form 上, 我希望 進入的時候 會自動改變該元件 的 顏色. 高度 ....等屬性..又不想用下面這種 方法 (因為可能會有30個 edit) 請問各位高手 有其他好 方法 嗎...謝謝.... procedure TForm1.Edit1Enter(Sender: TObject); begin if sender = edit1 Then begin edit1.Color := clAqua; edit1.Font.Color := clred; edit1.Height := 40; end else if sender = edit2 then begin edit2.Color := clAqua; edit2.Font.Color := clred; edit2.Height := 40; end else if sender = edit3 then begin edit3.Color := clAqua; edit3.Font.Color := clred; edit3.Height := 40; end; end;
jest0024
高階會員


發表:11
回覆:310
積分:224
註冊:2002-11-24

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-03-24 23:15:16 IP:61.60.xxx.xxx 未訂閱
引言: 假設我有3個 edit 元件在 form 上, 我希望 進入的時候 會自動改變該元件 的 顏色. 高度 ....等屬性..又不想用下面這種 方法 (因為可能會有30個 edit) 請問各位高手 有其他好 方法 嗎...謝謝.... procedure TForm1.Edit1Enter(Sender: TObject); begin if sender = edit1 Then begin edit1.Color := clAqua; edit1.Font.Color := clred; edit1.Height := 40; end else if sender = edit2 then begin edit2.Color := clAqua; edit2.Font.Color := clred; edit2.Height := 40; end else if sender = edit3 then begin edit3.Color := clAqua; edit3.Font.Color := clred; edit3.Height := 40; end; end;
??
procedure TForm1.Edit1Enter(Sender: TObject);
begin
  if Sender is TEdit then
  with TEdit(Sender) do begin
    Color := clAqua;
    Font.Color := clred;
    Height := 40;
  end;
end;
jslucky
一般會員


發表:4
回覆:8
積分:2
註冊:2002-03-13

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-03-25 00:07:04 IP:211.72.xxx.xxx 未訂閱
這麼快就得到答應...果然是我要的..謝謝 jest0024...
系統時間:2024-07-06 19:19:08
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!