Flat button

  • Thread starter Thread starter Maileen
  • Start date Start date
M

Maileen

Hi,

I asked few days ago about a flat button control under VB.NET but answer
didn't satisfy me.

I know that a such button existed under VB6 so it should exist under
VB.NET also.

Where can i find this Flat button control ? COM, ActiveX ?

thanks a lot,
Maileen
 
Maileen,

What was the answer that didn't satisfy you, that would explain more than
only telling that it did not statisfy you, without that we know what it was.

Cor
 
In fact I was redirected to some VB power Pack image button...
but this solution is not acceptable for me because i already used a Flat
button from VB6 and it was enough for me.
I didn't need to add any new dll to my project, and so on...
I just want to have a simple button on which i can allow to be flat or
not (like buttons of Coolbars or toolbar).
Moreover, it could be super to have the possibility to add an image
beside the text (caption) of this button.

Maileen
 
Maileen said:
In fact I was redirected to some VB power Pack image button...
but this solution is not acceptable for me because i already used a Flat
button from VB6 and it was enough for me.
I didn't need to add any new dll to my project, and so on...
I just want to have a simple button on which i can allow to be flat or
not (like buttons of Coolbars or toolbar).
Moreover, it could be super to have the possibility to add an image
beside the text (caption) of this button.

Take a look at the buttons' 'FlatStyle' property...
 
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

Maileeb
 
You could always just inherit the standard windows button and override the
OnPaint event and just draw the button yourself... I did this to make a
flat button with rounded corners that changed colour as you brought the
mouse over it... pretty similar to your requirements...

If you need some code then I'll be happy to post mine as a starter..

Regards
Simon
 
Maileen said:
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(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.ImageAlign = ContentAlignment.MiddleLeft
Label1.TextAlign = ContentAlignment.MiddleRight
Label1.Image = Me.Icon.ToBitmap
Label1.BorderStyle = BorderStyle.None
Label1.Size = New Size(70, 34)
Label1.Text = "Button "
End Sub


Private Sub Label1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.MouseEnter
Dim Grx As Graphics = Me.CreateGraphics
ControlPaint.DrawBorder3D(Grx, New Rectangle(Label1.Left - 2, Label1.Top - 2, Label1.Width + 4, Label1.Height + 4),
Border3DStyle.RaisedInner)
Grx.Dispose()
End Sub

Private Sub Label1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.MouseLeave
Dim Grx As Graphics = Me.CreateGraphics
ControlPaint.DrawBorder(Grx, New Rectangle(Label1.Left - 2, Label1.Top - 2, Label1.Width + 4, Label1.Height + 4),
SystemColors.Control, ButtonBorderStyle.Solid)
Grx.Dispose()
End Sub

Private Sub Label1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles
Label1.MouseDown
Dim Grx As Graphics = Me.CreateGraphics
ControlPaint.DrawBorder3D(Grx, New Rectangle(Label1.Left - 2, Label1.Top - 2, Label1.Width + 4, Label1.Height + 4),
Border3DStyle.SunkenOuter)
Grx.Dispose()
End Sub

Private Sub Label1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseUp
Dim Grx As Graphics = Me.CreateGraphics
ControlPaint.DrawBorder3D(Grx, New Rectangle(Label1.Left - 2, Label1.Top - 2, Label1.Width + 4, Label1.Height + 4),
Border3DStyle.RaisedInner)
Grx.Dispose()
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

flat button 1
Multi page 1
Convert VB6 ActiveX Control to VB.NET And Incorporate it Into ASPX 0
to draw a 3D-line 3
hide the windows buttons 1
VB known application 2
simulate an event 3
SDI under VB.NET 1

Back
Top