以下内容在 BCB 中运行通过,很像 QQ 那个:在OnDrawItem事件中写相关的代码:Style为:csOwnerDrawVariable;ItemHeight=32;void __fastcall TFrmMain::ComboBox1DrawItem(TWinControl *Control,
int Index, TRect &Rect, TOwnerDrawState State)
{
Graphics::TBitmap * pbmp=new Graphics::TBitmap();
ImageList1->GetBitmap(Index,pbmp);
TRect rect;
TRect dest=Rect;
dest.right=32;
rect.left=0;
rect.top=0;
rect.right=pbmp->Width;
rect.bottom=pbmp->Height;
ComboBox1->Canvas->CopyRect(dest,pbmp->Canvas,rect);
delete pbmp;
}
int Index, TRect &Rect, TOwnerDrawState State)
{
Graphics::TBitmap * pbmp=new Graphics::TBitmap();
ImageList1->GetBitmap(Index,pbmp);
TRect rect;
TRect dest=Rect;
dest.right=32;
rect.left=0;
rect.top=0;
rect.right=pbmp->Width;
rect.bottom=pbmp->Height;
ComboBox1->Canvas->CopyRect(dest,pbmp->Canvas,rect);
delete pbmp;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货