請問如何取消 TComboBox 的滑鼠滾輪的功能 |
答題得分者是:Fishman
|
esp_pzj
初階會員 發表:32 回覆:70 積分:40 註冊:2007-02-09 發送簡訊給我 |
|
Fishman
尊榮會員 發表:120 回覆:1949 積分:2163 註冊:2006-10-28 發送簡訊給我 |
在 On_Key_Down 事件下增加以下程式碼
<textarea class="delphi" rows="10" cols="60" name="code">procedure TForm1.ComboBox1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if (((Key = VK_UP) or (Key = VK_DOWN)) and not(TComboBox(SendeR).DroppedDown)) then Abort; end; </textarea> 缺點是,會連同上下鍵功能一起鎖掉
------
Fishman
編輯記錄
Fishman 重新編輯於 2007-05-04 16:45:12, 註解 forbidden‧
|
Fishman
尊榮會員 發表:120 回覆:1949 積分:2163 註冊:2006-10-28 發送簡訊給我 |
方法二:
拉一個 ApplicationEvents(在 Additional TAB 中),在其 OnMessage 事件中加入以下程式碼 <textarea class="delphi" rows="10" cols="60" name="code"> procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG; var Handled: Boolean); begin if ((Self.ActiveControl = Combobox2) and (Msg.message = WM_MOUSEWHEEL)) then Handled := True; end; </textarea>
------
Fishman |
esp_pzj
初階會員 發表:32 回覆:70 積分:40 註冊:2007-02-09 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |