Hi @Gary Smith ,
You can use a panel control and use the graphics drawing functions in the System.Drawing namespace to achieve.
Here is an example about drawing a circle.
Private Sub Panel1_Paint(sender As Object, e As PaintEventArgs) Handles Panel1.Paint
'Create a Graphics object
Dim g As Graphics = e.Graphics
'Create a circular path
Dim path As New Drawing2D.GraphicsPath()
path.AddEllipse(0, 0, Panel1.Width - 1, Panel1.Height - 1)
'Fill the path with color
g.FillPath(Brushes.Blue, path)
'Draw a border on the path
g.DrawPath(Pens.Black, path)
End Sub
If you want to modify the color of the ScrollBar, you can customize the appearance of the ScrollBar by extending the System.Windows.Forms.ScrollBar class and overriding the OnPaint method.
Use the following code to customize the scrollbar, then you can add the custom scrollbar to your form.
Imports System.Drawing.Drawing2D
Public Class CustomScrollBar
Inherits System.Windows.Forms.ScrollBar
'Override the OnPaint method
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
MyBase. OnPaint(e)
'Create a Graphics object
Dim g As Graphics = e. Graphics
'Set the background color to red
g.Clear(Color.Red)
'Create slider path
Dim path As New GraphicsPath()
path.AddRectangle(New Rectangle(0, 0, Me.Width, Me.Height))
'Set the slider color to yellow
g. FillPath(Brushes. Yellow, path)
End Sub
End Class
Best Regards.
Jiachen Li
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.