Please refer to the attached image


I want to create an application which provides toolbar 'button' like BatteryBar. Thanks for your help :)

Hi TungNk1993

Circle buttons instead of standard rectangular shaped buttons is quite complicated but for standard rectangular shaped button, it is simple using system.drawing.drawing2d

Dim linGrBrush As System.Drawing.Drawing2D.LinearGradientBrush

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'----Standard Color for the button...always it will be in this color
'----Note: I have given only as example ...do change the color for the better apperarance
        linGrBrush = New System.Drawing.Drawing2D.LinearGradientBrush(New Point(0, 0), New Point(20, 20), Color.LightGray, Color.LightBlue)

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'---- Color for the button when click triggers
'----Note: I have given only as example ...do change the color for the better
        linGrBrush = New System.Drawing.Drawing2D.LinearGradientBrush(New Point(0, 0), New Point(20, 20), Color.LightGray, Color.WhiteSmoke)
    End Sub

    Private Sub Button1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseEnter
'----Color for the button when mouse pointer enters
'----Note: I have given only as example ...do change the color for the better
        linGrBrush = New System.Drawing.Drawing2D.LinearGradientBrush(New Point(0, 0), New Point(20, 20), Color.LightGray, Color.DarkBlue)
    End Sub

    Private Sub Button1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseLeave
'----Standard Color for the button...always it will be in this color
'----Note: I have given only as example ...do change the color for the better
        linGrBrush = New System.Drawing.Drawing2D.LinearGradientBrush(New Point(0, 0), New Point(20, 20), Color.LightGray, Color.LightBlue)
    End Sub

    Private Sub Button1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Button1.Paint
        Dim B As New Pen(Color.AliceBlue)
        B.Brush = linGrBrush
        Button1.BackColor = B.Color
    End Sub

Change the color and the coordinates given since it is used for a line display..
Try studying some tutorial for System.Drawing.Drawing2D

Try changing the background image property also loading 3 different picture in resx...project resource

Rgrds

Sam

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.