掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
Style = csDropDownListのComboBoxをクリックしたときに、アイテムリストを表示させないようにするには? (ID:19761)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
type TMyCmbBox = class(TComboBox) private FBoolStartMove: Boolean; //移動開始フラグ FXbefore: integer; //移動前のクライアント座標 FYBefore: integer; //移動前のクライアント座標 private procedure WMLButtonDown(var Message: TWMLButtonDown); message WM_LBUTTONDOWN; procedure WMLButtonUp(var Message: TWMLButtonUp); message WM_LBUTTONUP; protected procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; end; procedure TMyCmbBox.WMLButtonDown(var Message: TWMLButtonDown); begin if (Style = csDropDownList) and (Message.XPos < (Width - GetSystemMetrics(SM_CXHSCROLL))) then begin //マウスキャプチャを解除 ReleaseCapture; //移動開始 FBoolStartMove := true; //移動前のクライアント座標を記録 FXbefore := Message.XPos; FYbefore := Message.YPos; end else begin inherited; end; end; procedure TMyCmbBox.WMLButtonUp(var Message: TWMLButtonUp); begin //移動フラグ解除 FBoolStartMove := false; inherited; end; procedure TMyCmbBox.MouseMove(Shift: TShiftState; X, Y: Integer); begin if FBoolStartMove = true then begin //(X - FXbefore) : X方向の移動量 Self.Left := Self.Left + (X - FXbefore); Self.Top := Self.Top + (Y - FYbefore); end; inherited; end;
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.