国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

ListBox編程兩例

2019-11-17 05:24:46
字體:
來源:轉載
供稿:網友
1。 為ListBox添加水平方向的滾動條

SendMessage (ListBox1->Handle,LB_SETHORIZONTALEXTENT,ListBox1->Width + 32,0) ;

2。 為Listbox添加圖標

首先需要設置Listbox的Style屬性為lbOwnerDrawVariable;

const margin = 2 ; // Margin around each bitmap

//---------------------------------------------------------------------------
void __fastcall TForm1::ListBox1MeasureItem(TWinControl *Control, int Index,
int &Height)
{
Height = ImageList1->Height + margin * 2 ;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ListBox1DrawItem(TWinControl *Control, int Index,
TRect &Rect, TOwnerDrawState State)
{
// 填充背景.
ListBox1->Canvas->FillRect (Rect) ;
// 畫出圖像.
ImageList1->Draw (ListBox1->Canvas, Rect.Left + margin, Rect.Top + margin, Index) ;

// 畫出文字.
String text = ListBox1->Items->Strings [Index] ;
// Center the text vertically in relation to the bitmap.
int off = (Rect.Bottom - Rect.Top - ListBox1->Canvas->TextHeight (text)) / 2 ;
ListBox1->Canvas->TextOut (Rect.Left + ImageList1->Width + 2 * margin,
Rect.Top + off,text) ;
}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 秦安县| 鄂托克旗| 旬阳县| 上栗县| 松江区| 弥勒县| 正安县| 安图县| 邮箱| 邢台市| 那坡县| 牡丹江市| 扶风县| 阳新县| 福海县| 沧州市| 玉环县| 耒阳市| 澄迈县| 镇雄县| 定结县| 芒康县| 毕节市| 井研县| 莎车县| 若尔盖县| 榕江县| 襄垣县| 兴义市| 行唐县| 珠海市| 邯郸市| 瑞安市| 白银市| 余庆县| 晴隆县| 扬中市| 新巴尔虎右旗| 临洮县| 利川市| 湟源县|