如何製作有顏色的ListBox下拉列表

2021-06-21 17:04:02 字數 490 閱讀 8990

經常我們會遇到要做乙個選擇顏色的listbox的情況,下面通過使用乙個html控制項,如<\select> 標籤來實現listbox功能,往往比使用.更加方便和功能強大,比如在標籤內設定 style.   第一步:把乙個普通的<\select> 標籤轉換成端控制項,只需要在svcej.com

tom waits

nina hagen

marianne rosenberg

第二步:在**頁定義top5控制項,www.trruc.com

protected system.web.ui.htmlcontrols.htmlselect top5;

第三步:在**頁設定 style

top5.items[0].attributes.cssstyle.add("color","red");

top5.items[1].attributes.cssstyle.add("background", "blue");

第四步:最後在html**裡面的結果

帶顏色的listbox控制項

private sub filllistboxwithcolors me.listbox1.drawmode drawmode.ownerdrawfixed me.listbox1.itemheight 24 避免閃爍 me.listbox1.beginupdate listbox1.items.c...

在C 中控制ListBox某一行的字型顏色

private void form1 load object sender,eventargs e private void listbox1 drawitem object sender,drawitemeventargs e e.graphics.fillrectangle newsolidbr...

WP中如何為ListBox中的item動態生成模板

本文原文見windowgeek。在window phone中,我們常常遇到一些情形,譬如在listbox中,我們要根據具體的data來決定該如何顯示當前項。這可以通過datatemplateselector來實現。實現datatemplateselector抽象類 public abstract c...