如何在Combobox的Item后添加一个按钮 RT类似QQ2009的登录界面在每一项的后面加一个删除按钮,表示点下这个按钮就会删除Combobox的这一项 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);begin ComboBox1.Canvas.Font.Color := ComboBox1.Font.Color; ComboBox1.Canvas.TextOut(Rect.Left,Rect.Top,ComboBox1.Items.Strings[index]); ComboBox1.Canvas.Font.Color := clRed; ComboBox1.Canvas.TextOut(Rect.Right - 16,Rect.Top,'x');end; 那我要将下拉列表中的内容加到combobox的编辑框里,后面的‘x ’是不是也进去了,怎么把叉去掉呢?? 那我要将下拉列表中的内容加到combobox的编辑框里,后面的‘x ’是不是也进去了,怎么把叉去掉呢?? //x去掉就去掉呗ComboBox1.Canvas.TextOut(Rect.Right - 16,Rect.Top,''); 先把style := csOwnerDrawFixed;procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); var aRect : TRect;begin aRect := Rect; aRect.Right := Rect.Right; aRect.Left := Rect.Left+80; ComboBox1.Canvas.Font.Color := clBlue; ComboBox1.Canvas.TextRect(Rect,Rect.Left,Rect.Top,ComboBox1.Items[index]); ComboBox1.Canvas.Font.Color := clRed; ComboBox1.Canvas.TextRect(aRect,aRect.Right-20,aRect.Top,'X');end; 真是厉害啊,用一个button控件代替那个‘x'可以吗 我记得可以在标题栏上画按钮。而且可以触发按钮的事件。lz 找找帖子,然后把这个按钮画到 List 里看看有没有效果。 如何使用ADOQuery向Access和SQL Server插入数据 关于ado连接sql server 為什麼我的視圖 view 數據集 無法修改? 怎么找到窗口的所有属性 并给他赋值 请教数据还原问题 当在DBGRID中新增时,光标要自动移到新增行的第一列,如何处理,在线等 高手赶紧过来看看啊 为什么我的程序开销这么大,大家帮忙看看!!谢谢了,斑竹们也来看看,给点意见 为什么窗体在显示为模式窗体时要报错? socket编程问题 跪求数据库的某表中数据是怎么添加进去的?存储过程,触发器都没有对表添加数据。 webcopy能不能删除FTP服务器上的文件?
procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
begin
ComboBox1.Canvas.Font.Color := ComboBox1.Font.Color;
ComboBox1.Canvas.TextOut(Rect.Left,Rect.Top,ComboBox1.Items.Strings[index]);
ComboBox1.Canvas.Font.Color := clRed;
ComboBox1.Canvas.TextOut(Rect.Right - 16,Rect.Top,'x');
end;
//x去掉就去掉呗
ComboBox1.Canvas.TextOut(Rect.Right - 16,Rect.Top,'');
procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var
aRect : TRect;
begin
aRect := Rect;
aRect.Right := Rect.Right;
aRect.Left := Rect.Left+80;
ComboBox1.Canvas.Font.Color := clBlue;
ComboBox1.Canvas.TextRect(Rect,Rect.Left,Rect.Top,ComboBox1.Items[index]);
ComboBox1.Canvas.Font.Color := clRed;
ComboBox1.Canvas.TextRect(aRect,aRect.Right-20,aRect.Top,'X');
end;
lz 找找帖子,然后把这个按钮画到 List 里看看有没有效果。