Public Class Close
Inherits Windows.Forms.Button
Public Sub New()
Me.Size = New System.Drawing.Point(25, 25)
Me.FlatStyle = Windows.Forms.FlatStyle.Flat
Me.BackgroundImage = My.Resources.CloseNormal
Me.BackgroundImageLayout = Windows.Forms.ImageLayout.Stretch
Me.BackColor = Drawing.Color.Transparent
Me.Font = New System.Drawing.Font("Calibri", 10, Drawing.FontStyle.Regular, Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.ForeColor = Drawing.Color.Black
Me.FlatAppearance.BorderColor = Drawing.Color.DeepSkyBlue
Me.FlatAppearance.MouseDownBackColor = Drawing.Color.Transparent
Me.FlatAppearance.MouseOverBackColor = Drawing.Color.Transparent
Me.FlatAppearance.BorderSize = 0
End Sub
Private Sub Button1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
Me.BackgroundImage = My.Resources.ClosePress
End Sub
Private Sub Button1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseEnter
Me.BackgroundImage = My.Resources.CloseNormal
End Sub
Private Sub Button1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseHover
Me.BackgroundImage = My.Resources.CloseHigh
End Sub
Private Sub Button1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseLeave
Me.BackgroundImage = My.Resources.CloseNormal
End Sub
End Class
I want to replace a button with another yet different button (eg. Maximise with RestoreDown). How can I do this?
The code above is for making a custom button.