"Maileen" <no****@email.c om> wrote
Ok, i should precised that i don't want this type of flat button because
it just make ablack border to my button...
I would like to have in fact, the button type that :
1. when mouse pointer is not on button, button is completly flat
2. when mouse pointer is over button, button style is raised
absolutely like button on Toolbar or Coolbar
You could handle it yourself, and maybe wrap up the code in a
user control (for re-use). The code below isn't all you need, but
it should get you started....
Add a label to a new form and paste in the code below:
HTH
LFS
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
Label1.ImageAli gn = ContentAlignmen t.MiddleLeft
Label1.TextAlig n = ContentAlignmen t.MiddleRight
Label1.Image = Me.Icon.ToBitma p
Label1.BorderSt yle = BorderStyle.Non e
Label1.Size = New Size(70, 34)
Label1.Text = "Button "
End Sub
Private Sub Label1_MouseEnt er(ByVal sender As Object, ByVal e As System.EventArg s) Handles Label1.MouseEnt er
Dim Grx As Graphics = Me.CreateGraphi cs
ControlPaint.Dr awBorder3D(Grx, New Rectangle(Label 1.Left - 2, Label1.Top - 2, Label1.Width + 4, Label1.Height + 4),
Border3DStyle.R aisedInner)
Grx.Dispose()
End Sub
Private Sub Label1_MouseLea ve(ByVal sender As Object, ByVal e As System.EventArg s) Handles Label1.MouseLea ve
Dim Grx As Graphics = Me.CreateGraphi cs
ControlPaint.Dr awBorder(Grx, New Rectangle(Label 1.Left - 2, Label1.Top - 2, Label1.Width + 4, Label1.Height + 4),
SystemColors.Co ntrol, ButtonBorderSty le.Solid)
Grx.Dispose()
End Sub
Private Sub Label1_MouseDow n(ByVal sender As Object, ByVal e As System.Windows. Forms.MouseEven tArgs) Handles
Label1.MouseDow n
Dim Grx As Graphics = Me.CreateGraphi cs
ControlPaint.Dr awBorder3D(Grx, New Rectangle(Label 1.Left - 2, Label1.Top - 2, Label1.Width + 4, Label1.Height + 4),
Border3DStyle.S unkenOuter)
Grx.Dispose()
End Sub
Private Sub Label1_MouseUp( ByVal sender As Object, ByVal e As System.Windows. Forms.MouseEven tArgs) Handles Label1.MouseUp
Dim Grx As Graphics = Me.CreateGraphi cs
ControlPaint.Dr awBorder3D(Grx, New Rectangle(Label 1.Left - 2, Label1.Top - 2, Label1.Width + 4, Label1.Height + 4),
Border3DStyle.R aisedInner)
Grx.Dispose()
End Sub