ListBox自绘

DrawItem事件中
TCanvas *pCanvas;
  pCanvas = ((TListBox *)Control)->Canvas;
  pCanvas->Brush->Color = clWhite;
  pCanvas->Font->Color = clBlack;
  pCanvas->FillRect(Rect);
  pCanvas->Brush->Color = TColor(0x00FFF7F7);
  pCanvas->Pen->Color = TColor(0x00131315);
  pCanvas->Rectangle(Rect.left+2,Rect.Top+2,Rect.right-2,Rect.bottom-2);
  if(State.Contains(odSelected))
  {
   ListBox1->Canvas->Brush->Color = TColor(0x00FFB2B5);
   pCanvas->Rectangle(Rect.left+2,Rect.Top+2,Rect.right-2,Rect.bottom-2);
    ListBox1->Canvas->Font->Color = clBlue;
  }
 if(State.Contains(odFocused))
  ::DrawFocusRect(pCanvas->Handle, &Rect);
  pCanvas->Draw(Rect.left+4,Rect.top+(Rect.Height()-Image2->Height)/2,Image2->Picture->Graphic);
  pCanvas->TextOutA(Rect.left+4+Image2->Width+4,Rect.top+6,((TListBox *)Control)->Items->Strings[Index]);


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值