怎样将combobox的每一个item都有不同的字体,和颜色

newair 2003-06-16 05:02:26
怎样将combobox的每一个item都有不同的字体,和颜色
...全文
150 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
newair 2003-06-19
  • 打赏
  • 举报
回复
.............................
fengjn 2003-06-17
  • 打赏
  • 举报
回复
看看delphi6中的colorBox控件,很详细的。
lion_lh 2003-06-16
  • 打赏
  • 举报
回复
设置ComboBox1.Stylec:=sOwnerDrawFixed
// in FormCreate:
with ComboBox1.Items do
begin
Add(IntToStr(clRed));
Add(IntToStr(clFuchsia));
Add(IntToStr(clBlue));
Add(IntToStr(clGreen));
Add(IntToStr(clYellow));
end;
procedure TForm1.ComboBox1DrawItem(Control: TWinControl;
Index : Integer; Rect: TRect; State: TOwnerDrawState);
begin
with Control as TComboBox,Canvas do
begin
// fill the rectangle first with white
Brush.Color := clWhite;
FillRect(Rect);
// then reduce it and fill it with the color
InflateRect(Rect,-2,-2);
Brush.Color := StrToInt(Items[Index]);
FillRect(Rect);
end;
end;

ksaiy 2003-06-16
  • 打赏
  • 举报
回复
在DELPHI猛料里有介绍的,你去查查~
newair 2003-06-16
  • 打赏
  • 举报
回复
jjj

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧