Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / October 2004

Tip: Looking for answers? Try searching our database.

Flat button

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Maileen - 30 Oct 2004 11:15 GMT
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
Cor Ligthert - 30 Oct 2004 11:26 GMT
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

"Maileen" <nospan@email.com>
..
> Hi,
>
[quoted text clipped - 8 lines]
> thanks a lot,
> Maileen
Maileen - 30 Oct 2004 11:42 GMT
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,
>
[quoted text clipped - 18 lines]
>>thanks a lot,
>>Maileen
Herfried K. Wagner [MVP] - 30 Oct 2004 11:49 GMT
"Maileen" <nospan@email.com> schrieb:
> 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
[quoted text clipped - 4 lines]
> 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...

Signature

Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/

Maileen - 30 Oct 2004 12:27 GMT
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

> "Maileen" <nospan@email.com> schrieb:
>
[quoted text clipped - 8 lines]
>
> Take a look at the buttons' 'FlatStyle' property...
Larry Serflaten - 30 Oct 2004 14:00 GMT
> Ok, i should precised that i don't want this type of flat button because
>   it just make ablack border to my button...
[quoted text clipped - 5 lines]
>
> 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
Cor Ligthert - 30 Oct 2004 12:15 GMT
Maileen,

Why do you not use the flatstyle property of the normal Button.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fsystemwindowsformsbuttonbaseclassflatstyletopic.asp


However I think that the toolbar can as well do a good job for you.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fsystemwindowsformstoolbarclassbuttonstopic.asp


I hope this helps?

Cor

"Maileen" <nospan@email.com> > 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.
[quoted text clipped - 29 lines]
>>>thanks a lot,
>>>Maileen
Simon Verona - 30 Oct 2004 13:36 GMT
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,
>
> Why do you not use the flatstyle property of the normal Button.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fsystemwindowsformsbuttonbaseclassflatstyletopic.asp


> However I think that the toolbar can as well do a good job for you.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fsystemwindowsformstoolbarclassbuttonstopic.asp


> I hope this helps?
>
[quoted text clipped - 35 lines]
> >>>thanks a lot,
> >>>Maileen

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.