请问这种样子的的ComboBox怎么做? 我想让ComboBox里面只显示Icon,就是说让客户选择图标的一个ComboBox,而且尽量是大图标(32*32),该怎么做呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我就不灌水啦,我在这里有发过一贴类似回复的,应该可以抛砖引玉http://expert.csdn.net/Expert/TopicView1.asp?id=1354512 除了ComboBox1.Style = csOwnerDrawFixed,还有两个属性如下设置:ComboBox1.ItemHeight = 32;ComboBox1.DropDownCount = 2;再适当调整一下它的宽度。在Form上放一个TImageList,把它的Height属性设为32,然后随便加几个OICQ的bmp文件;在ComboBox的OnDrawItem事件里——procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);begin ComboBox1.Canvas.Brush.Color := clWindow; if odSelected in State then ComboBox1.Canvas.Brush.Color := clHighLight; ComboBox1.Canvas.FillRect(Rect); ImageList1.Draw(ComboBox1.Canvas, Rect.Left, Rect.Top, Index);end;为了初始化ComboBox里Items的个数,可以在它的OnDropDown事件里——procedure TForm1.ComboBox1DropDown(Sender: TObject);begin if ComboBox1.Items.Count <> ImageList1.Count then ComboBox1.Items.Text := StringOfChar(#13, ImageList1.Count);end; 用delphi7就ok了他自带了comboboxEx控件,不用自己操心了 怎样给TMainMenu添加mousemove事件? socketconnection连内网IP可以,但换成其公网IP就连不上? 一个小问题 少林寺公开武功秘籍!!!! 可以不用buf做中介,就把数据从一个MemoryStream复制到另一个MemoryStream吗? 原码 有没有办法 从中文字符串生成拼音字母的字串? 好老师我会另开贴给分 如何把这样的字符转成数字,然后再转回来,急,菜鸟求救 Help! 关于MDI窗体的问题 自己建了一个类,大家看看,哪里错了(有原码) 菜問題: Tstring 和String 的區別,還有怎樣將Tcaption數據轉化為Tstring?
我在这里有发过一贴类似回复的,应该可以抛砖引玉
http://expert.csdn.net/Expert/TopicView1.asp?id=1354512
ComboBox1.ItemHeight = 32;
ComboBox1.DropDownCount = 2;
再适当调整一下它的宽度。在Form上放一个TImageList,把它的Height属性设为32,然后随便加几个OICQ的bmp文件;
在ComboBox的OnDrawItem事件里——procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
begin
ComboBox1.Canvas.Brush.Color := clWindow;
if odSelected in State then ComboBox1.Canvas.Brush.Color := clHighLight;
ComboBox1.Canvas.FillRect(Rect);
ImageList1.Draw(ComboBox1.Canvas, Rect.Left, Rect.Top, Index);
end;为了初始化ComboBox里Items的个数,可以在它的OnDropDown事件里——procedure TForm1.ComboBox1DropDown(Sender: TObject);
begin
if ComboBox1.Items.Count <> ImageList1.Count then
ComboBox1.Items.Text := StringOfChar(#13, ImageList1.Count);
end;
他自带了comboboxEx控件,不用自己操心了