Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CheckedListbox onDrawItem - how to render the checkbox
Message
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Titre:
CheckedListbox onDrawItem - how to render the checkbox
Versions des environnements
Environment:
VB.NET 1.1
OS:
Windows Server 2012
Network:
Windows NT
Database:
Jet/Access Engine
Application:
Desktop
Divers
Thread ID:
01595643
Message ID:
01595643
Vues:
47
The method below belongs to a base class and gets fired alright.

Unfortunately I don't know how to render the checkbox in front of the item string.
   Protected Overrides Sub OnDrawItem(e As DrawItemEventArgs)
        e.DrawBackground()
        If e.State = DrawItemState.Focus Then
            e.DrawFocusRectangle()
        End If
        Dim index = e.Index
        If index < 0 OrElse index >= Items.Count Then
            Return
        End If
        Dim item = Items(index)
        Dim text As String
        text = If((item Is Nothing), "(null)", item.ToString())
        Using brush = New SolidBrush(e.ForeColor)
            e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit
            e.Graphics.DrawString(text, Me.Font, brush, e.Bounds)
        End Using
    End Sub

If things have the tendency to go your way, do not worry. It won't last. Jules Renard.
Répondre
Fil
Voir

Click here to load this message in the networking platform