人人做人人澡人人爽欧美,国产主播一区二区,久久久精品五月天,羞羞视频在线观看免费

當前位置:蘿卜系統下載站 > 技術開發教程 > 詳細頁面

帶顏色的listbox控件

帶顏色的listbox控件

更新時間:2022-09-02 文章作者:未知 信息來源:網絡 閱讀次數:

 Private Sub filllistboxwithcolors()

        Me.ListBox1.DrawMode = DrawMode.OwnerDrawFixed

        Me.ListBox1.ItemHeight = 24

        '避免閃爍

        Me.ListBox1.BeginUpdate()

        ListBox1.Items.Clear()

        Dim pi As Reflection.PropertyInfo

        For Each pi In GetType(Color).GetProperties(Reflection.BindingFlags.Public Or Reflection.BindingFlags.Static)

            Me.ListBox1.Items.Add(pi.Name)

        Next

        ListBox1.EndUpdate()

 

    End Sub

 

    Private Sub ListBox1_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles ListBox1.DrawItem

        Dim rect As Rectangle = e.Bounds '每一項的邊框

        If e.State And DrawItemState.Selected Then

            e.Graphics.FillRectangle(SystemBrushes.Window, rect)

 

        End If

        Dim colorname As String = ListBox1.Items(e.Index)

        Dim b As New SolidBrush(Color.FromName(colorname))

        rect.Inflate(-16, -2)

        e.Graphics.FillRectangle(b, rect)

        e.Graphics.DrawRectangle(Pens.Black, rect)

        Dim b2 As Brush

        If CInt(b.Color.R) + CInt(b.Color.G) + CInt(b.Color.B) > 128 * 3 Then

            b2 = Brushes.Black

        Else

            b2 = Brushes.White

 

        End If

        e.Graphics.DrawString(colorname, Me.ListBox1.Font, b2, rect.X, rect.Y)

    End Sub


溫馨提示:喜歡本站的話,請收藏一下本站!

本類教程下載

系統下載排行

網站地圖xml | 網站地圖html
主站蜘蛛池模板: 舒城县| 瑞昌市| 阿克苏市| 双辽市| 天全县| 游戏| 建水县| 花莲市| 太仓市| 苏尼特右旗| 九龙县| 息烽县| 大方县| 鞍山市| 丹江口市| 孙吴县| 武强县| 天峻县| 临清市| 铁岭市| 蓬安县| 塔河县| 平顶山市| 民和| 松潘县| 平谷区| 金门县| 泽库县| 邯郸市| 资溪县| 剑河县| 吉隆县| 柯坪县| 张北县| 逊克县| 沛县| 浑源县| 大冶市| 宜兰市| 安塞县| 茂名市|