Nov 21, 2009
Pages: 1, 2

VB.NET: How To Create Aqua Buttons - Pulsing & with rounded edges like OS-X

free web hosting

Read Latest Entries..: (Post #11) by iGuest on Mar 6 2008, 06:55 AM.
vb.net animated button creation VB.NET: How To Create Aqua Buttons How to create animated button in vb.Net.-question by guna
Read the FIRST post of this Topic. - Express your Opinion! Contribute Knowledge :-).

Open Discussion & Free Web Hosting > Computers & Tech > How-To's and Tutorials > Programming > .NET (VB, C# & J#)

VB.NET: How To Create Aqua Buttons - Pulsing & with rounded edges like OS-X

miCRoSCoPiC^eaRthLinG
Hi all,
I'll be brief about it. The original code was NOT written by me - the author is a certain Mr. Dave Peckham whose article titled AquaButton: A sample custom button control with a Mac OS X look can be found at CodeProject.Com. The original code was written in C# though - and my development platform was VB.NET - so I ported the code to VB.NET and here I am posting it for all of you.

    If you are unsure what an Aqua Button is - take a look at the following picture:


    Right - as you can see this will help you change the look of you .NET applications entirely. For C# you can use the code by the original author - and for VB.NET you can use mine. You'll find all the code needed in the attachment with this post - along with three .png picture files titled:
  • left.png
  • right.png
  • fill.png
    These make up the left, right and body of the button. Feel free to relpace these with any other color - try experimenting with different kind of edge shapes and fill body. The fourth file in the zip is the main AquaButton.vb class that will draw the aqua button on your forms. You have to include all 4 files in your project and preferrably leave the .png files in the directory from which your application will run. That is necessary for the code to be able to load the pictures that give the button it's custom shape.

    Only flip side with this is - that the button is not compiled as a User Control and hence not accessible as a Form Designer component. (Maybe, I'll modify it soon to be one). Till then, you have to add the buttons to your project programmatically. A little explanation on that - if you look at the code view of you project (considering a blank form with only one button), inside the "Windows Forms Designer Generated Region", you'll see the standard windows default buttons are added similar to the following format:
CODE
Me.Button1 = New System.Windows.Forms.Button
....
.......
Me.Button1.BackColor = System.Drawing.Color.LightGray
Me.Button1.Location = New System.Drawing.Point (100, 100)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size (60,24)
Me.Button1.TabIndex = 1
Me.Button1.Text = "OK"


     If you delete your button in the designer - this code will go away. So make sure you note down the Location and Size of your buttons prior to deletion. Since the Aqua Button class inherits the Windows Button Class - all the default button properties are accessible in the Aqua Buttons too.

    Towards the top of your code, above the windows forms designer generate region add in a statement:
CODE

Friend Withevents Button1 As WildGrape.Aqua.Controls.Button


     Inside your Form_Load procedure add the following statements:
CODE
Button1 = New WildGrape.Aqua.Controls.Button
Me.Controls.Add (Button1)
'The rest is the same as the syntax for the default buttons
Me.Button1.BackColor = System.Drawing.Color.LightGray
Me.Button1.Location = New System.Drawing.Point (100, 100)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size (60,24)
Me.Button1.TabIndex = 1
Me.Button1.Text = "OK"


Compile your code and have fun smile.gif
.:: Cheers ::.

Download the attachment (Zipped with WinZip 9):
[attachment=58:attachment]

Download the attachment (Zipped with Windows Zipper):
[attachment=316:attachment]

 

 

 


Comment/Reply (w/o sign-up)

Ryan
Interesting code, bit why would you want an aqua button, that makes no sense to me, that would be like if somone created a ipb skin to look like the defualt skin of another BBS. where is the pride of your os to use its buttons?

Comment/Reply (w/o sign-up)

miCRoSCoPiC^eaRthLinG
Don't you get bored by the standard windows buttons ?? That was one of the primary reasons I took the pain to convert this code from C#... But it's not just limited to aqua buttons - if you modify the image files, and a little bit of the code - you can infact put ANY shape/size/color of buttons in your appz. That's the cool part about this code.. I'll try posting a small followup on howto do it. Believe me, it can completely change the look of your app

Comment/Reply (w/o sign-up)

vizskywalker
I think it is a great idea, and I can't wait for a follow up. Now if only I had a full version of VB instead of the introductory version. Thanks microscopic^earthling.

Comment/Reply (w/o sign-up)

h3lium
interesting idea, i had never thought of this. do you have the c# code or a link to it?

Comment/Reply (w/o sign-up)

miCRoSCoPiC^eaRthLinG
QUOTE (h3lium @ Aug 11 2005, 01:56 AM)
interesting idea, i had never thought of this. do you have the c# code or a link to it?
*


Look right up on top of the first article. The original C# article that is cited as the C# version of this code is itself the link ..

Comment/Reply (w/o sign-up)

willytb
Can't seem to unzip the attachment with WINXP unzipper? Do I need a special unzip program?


Notice from miCRoSCoPiC^eaRthLinG:
Please stop quoting a whole post when your feedback is just one line.

Comment/Reply (w/o sign-up)

miCRoSCoPiC^eaRthLinG
I don't know about WinXP unzipper - I never trusted it much. I packed this file using Winzip v9 - which you can download from http://www.winzip.com Infact it's in version 10 now - but that wouldn't be a problem. I downloaded the file and tested it again - no problem with Winzip or WinRAR (http://www.winrar.com)

Comment/Reply (w/o sign-up)

warbird
I tried to unzip it with WinRar but it gives errors all the time:

QUOTE
Unknown method in right.png
Unknown method in fill.png
Unknown method in left.png
Unknown method in AquaButton.vb
No files to extract


Where did you zipped it with? Could you reupload it? plzzzzz *begging* or do you want me to download winzip?

-=jeroen=-

Comment/Reply (w/o sign-up)

miCRoSCoPiC^eaRthLinG
Cool - I've added another ZIP with the same files, this time zipped using Windows default zipper in Normal compression mode. The file is called Aqb.zip - you'll find it attached to the first post.

Comment/Reply (w/o sign-up)

Latest Entries

iGuest
vb.net animated button creation
VB.NET: How To Create Aqua Buttons

How to create animated button in vb.Net.

-question by guna

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Pages: 1, 2
Similar Topics

Keywords : Vbnet Aqua Buttons Pulsing Amp Rounded Edges Os


    Looking for vb, net, howto, create, aqua, buttons, pulsing, and, rounded, edges, osx

See Also,

*SIMILAR VIDEOS*
Searching Video's for vb, net, howto, create, aqua, buttons, pulsing, and, rounded, edges, osx
advertisement



VB.NET: How To Create Aqua Buttons - Pulsing & with rounded edges like OS-X

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com