📄 combobox特效.txt
字号:
TComboBox当 鼠 标 在 下 拉 列 表 上 移 动 ( 并 未 选 定 ) 时 能 触 发 什 么 事 件 吗 ? 因 为 我 想 得 到
当 前 鼠 标 正 在 哪 个 Item上 。
自 定 义 ComboBox.OnDrawItem事 件 , 设 置 ComboBox.Style为 csOwnerDrawFixed。
在 OnDrawItem事 件 中 , 添
procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
begin
if odSelected in State then begin ComboBox1.Canvas.Brush.Color:=clHighlight;
ComboBox1.Canvas.Font.Color: =clHighlightText;
Caption:=ComboBox1.Items[index];
end
else
begin
ComboBox1.Canvas.Brush.Color:=clWindow;
ComboBox1.Canvas.Font.Color:=clWindowText;
end;
ComboBox1.Canvas.TextRect(rect
rect.left+2
rect.top+2
ComboBox1.Items[index]);
end;
则 Form1的 Caption会 显 示 当 前 鼠 标 所 在 Item。
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -