Donate

Apply ComboBox Border Color In VB.NET Windows Forms

Here's a simple way to decorate border color in Combobox control. The solution is a conversion of C# code originally developed by a C# Corner forum member.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
Public Sub New()
        ' This call is required by the designer.
        InitializeComponent()
        ' Add any initialization after the InitializeComponent() call.
        AddHandler Me.Paint, AddressOf DrawBorder
    End Sub
 
    Private Sub DrawBorder(ByVal sender As Object, ByVal e As PaintEventArgs)
        Dim rect As New Rectangle(Me.ComboBox1.Location.X - 1,
                                  Me.ComboBox1.Location.Y - 1,
                                  Me.ComboBox1.Width + 1,
                                  Me.ComboBox1.Height + 1)
 
        Dim pen As New Pen(Color.Red, 1)
        Dim g As Graphics = e.Graphics
        g.DrawRectangle(pen, rect)
    End Sub

Customized Combobox
Apply ComboBox Border Color In VB.NET Windows Forms

Comments

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

How To Insert Or Add Emojis In Microsoft Teams Status Message

Pass GUID As Parameter To Action Using ASP.NET MVC ContribGrid