欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來到入門教程網(wǎng)!

Delphi

當(dāng)前位置:主頁(yè) > 軟件編程 > Delphi >

Delphi實(shí)現(xiàn)Listbox中的item根據(jù)內(nèi)容顯示不同顏色的方法

來源:本站原創(chuàng)|時(shí)間:2020-01-10|欄目:Delphi|點(diǎn)擊: 次

本文簡(jiǎn)述了Delphi實(shí)現(xiàn)Listbox中的item根據(jù)內(nèi)容顯示不同顏色的方法,實(shí)現(xiàn)步驟如下:

ListBox1 的 Style 屬性改為 lbOwnerDrawVariable

在ListBox的OnDrawItem事件裡,根據(jù)item的值,改變Canvas屬性

示例代碼如下:

procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
begin    //字體用原來默認(rèn)的顏色
 if Odd(index) then   //當(dāng)items的index為奇數(shù)時(shí)的顏色
 begin
  listbox1.Canvas.Brush.Color:=clwindow;
  ListBox1.Canvas.TextRect(Rect,rect.Left,Rect.Top,ListBox1.Items[index]);
 end
 else     //當(dāng)items的index為偶數(shù)時(shí)的顏色
 begin
  listbox1.Canvas.Brush.Color:=clinactivecaptiontext;
  ListBox1.Canvas.TextRect(Rect,rect.Left,Rect.Top,ListBox1.Items[index]);
 end;
 if  odSelected  in  state  then    //當(dāng)選定時(shí)的顏色
 begin
  listbox1.Canvas.Brush.Color:=clhighlight;
  ListBox1.Canvas.TextRect(Rect,rect.Left,Rect.Top,ListBox1.Items[index]);
 end;
end;

網(wǎng)頁(yè)制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語(yǔ)言數(shù)據(jù)庫(kù)服務(wù)器

如果侵犯了您的權(quán)利,請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)進(jìn)行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有