Quick Search for:  in language:    
multistyle,command,button,your,applications,e
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
Visual Basic Stats

 Code: 3,014,970. lines
 Jobs: 119. postings

 How to support the site

 
Sponsored by:

 

You are in:

 
Login



Latest Code Ticker for Visual Basic.
Click here to see a screenshot of this code!Excel Into a webpage
By Bill Donahue on 7/2

(Screen Shot)

Unroll2 - Update
By Cyber Chris on 7/2


MultilinePWD
By Cyber Chris on 7/2


Click here to see a screenshot of this code!Song/Poem Assistant
By Peter Rowan on 7/2

(Screen Shot)

Click here to see a screenshot of this code!GPA Cal
By KBM-00 on 7/2

(Screen Shot)

Click here to see a screenshot of this code!Connection Via the Telephone line.No internet or cable.Just the telephone line
By Nass ClickMan on 7/2

(Screen Shot)

DBTool
By Make Strömberg on 7/2


Click here to see a screenshot of this code!MSChart Simple Example
By Sebastian Pereira on 7/2

(Screen Shot)

CString v1.5
By Ultimatum on 7/2


Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 
   

CHAMELEON BUTTON - An awesome multi-style button

Print
Email
 
winzip icon
Submitted on: 11/9/2001 1:32:12 AM
By: malachi  
Level: Advanced
User Rating: By 60 Users
Compatibility:VB 5.0, VB 6.0

Users have accessed this code 14966 times.
 
 
     This is a multi-style command button to add to your applications. It can emulate seven different styles at a very accurate way!!! see the screenshot to belive... you will really be astonished. And the best of all: no external dll's or ocx's need to be used, an even the XP button is ownerdrawn!!! A must have for any coder. UPDATE!!! now it supports cool color changes!

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzipto decompress it.

Virus note:All files are scanned once-a-day by Planet Source Code for viruses,but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:
1)Re-scan downloaded files using your personal virus checker before using it.
2)NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
3)Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
11/9/2001 2:08:03 AM:gonchuki
feel free to leave your comments...
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/9/2001 3:32:28 AM:bob
fantastic.
Great code
 5 *'s
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/9/2001 9:50:05 AM:JC
Excellent Work!!  I'd give you 6 globes 
if I could.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/9/2001 12:16:56 PM:Aaron Morris
Very nice .... You could add a mouse 
over state.  That would make the 
buttons even cooler.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/9/2001 12:26:38 PM:gonchuki
yes... i could do that but no one of 
these buttons have a mouse over state 
in real life
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/9/2001 1:37:31 PM:Marc
Great code.  One question though.  Is 
there an easy way to change it so the 
focus rectangle isn't there when you 
click on the buttons?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/9/2001 3:18:38 PM:gonchuki
I updated the zip with this feature. 
Now you can hide the focus rect.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/9/2001 5:34:33 PM:gonchuki
NEW UPDATE!!!            it now 
supports custom colors!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/10/2001 3:14:29 AM:Rayson
hey man, good code :) especially what 
you did with the XP button :) I LIKE !
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/10/2001 7:34:06 AM:shadowlynx
great code! is there a way to change 
the font of the buttons though?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/10/2001 10:40:17 AM:gonchuki
This property already exists since the 
first upload....
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/10/2001 11:50:11 AM:Jesse Wilson
Great code! I was working on a custom 
button myself, but your's is by far 
more stable and usable than mine at 
this point. There are two things I 
should point out however, and only b/c 
you asked in your code comments. 1) The 
XP button does not have the blue border 
highlight unless it is the default 
button, otherwise the border highlight 
is the same as the rest of the button, 
2) the XP button does have a mouse over 
effect, the border highlight turns an 
orange color. Other than those two 
items (really insignificant points at 
that) this is some nice professional 
coding... something that seems to be 
becoming a rarity on PSC anymore. Keep 
up the good work!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/10/2001 11:56:19 AM:Jesse Wilson
Oh before I forget, one other "problem" 
I noticed is that while the other 
button styles can have a custom or user 
chosen backcolor, the XP button style 
does not seem to be able to. That and 
it doesn't seem to match the system 
colors either. Fixing this shouldn't be 
an issue however, if I can "fix" it I 
will send you my update. Anyways, sorry 
for the nitpicking, and once again... 
great code!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/10/2001 7:47:15 PM:Slippah
Hey, great, and I mean GREAT code here. 
I've already implemented it in all of 
my best projects. One "itsy bitsy" 
comment/suggestion for ya'. You got the 
Windows XP Style Buttons wrong, not 
greatly, but wrong. I'm working on 
fixing it right now, but if you would 
like to see the template that I'm 
working from, this link will bring you: 
http://downloads.redjupiter.com/users/im
ages/JarrettInteraction/ButtonStates.jpg
Good job, 5 Globes!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/10/2001 9:57:31 PM:Ackbar
Very nice job here.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/11/2001 2:35:37 PM:Cory G.
i like this code, i am going to use it 
in my project to replace one of the 
buttons i was using from a ocx, i have 
added a very small amount of code to 
make the style of a flat button on ie5, 
if you want it just email me.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/12/2001 2:58:15 AM:Robin Schuil
Very nice code. However, it is not 
original. I've seen the same lib a few 
weeks ago on some other VB site. I will 
look up the URL and post it here..
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/12/2001 4:43:16 AM:Jon
These buttons are very nice, however 
what stops me using them is the absence 
of a picture property (and/or picture 
and text).
Great work though.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/12/2001 6:24:41 PM:mario
not original? this is Unique. it's the 
best button i've seen!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/12/2001 8:52:16 PM:nunya bidness
very nice 5 globes
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/13/2001 3:34:21 AM:dumbass
kick(butt)! :)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/13/2001 6:26:22 AM:tibisan
very nice, 5* from me!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/13/2001 8:16:41 AM:gonchuki
i'm working to fix the XP button, come 
soon to see!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/13/2001 1:01:02 PM:Mike Jenkings
Very nice work, easy to use and adds a 
touch of interest and professionalism 
to any project. Nice to be rid of those 
nasty gray buttons. 5*s 
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/13/2001 2:43:30 PM:gonchuki
UPDATE!!! the Windows XP buttons now 
look as they should. Thanks for the 
feedback and the votes folks!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/13/2001 9:34:19 PM:Vinchenzo
Incredible! It's simply wonderful and 
neat! No piggy coding here!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/14/2001 5:36:10 PM:PxHxAxNxTxOxM
Very, I mean VERY, excellent coding 
here.  I've been trying to simulate the 
exact same XP button since it came 
out...I just couldn't get it down 
pat...Thanks a million for this 
code...5 and 1/2 globes :)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/14/2001 5:38:04 PM:PxHxAxNxTxOxM
Dude, I've been workin on a WINXP 
button since it came out...Major Props 
to you dude.  I've d/led almost all 
your work, but my special favorite was 
your computer lock out thing...That was 
major sweet.  Keep up the good work! 5 
Globes
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/15/2001 9:58:21 AM:Janekk
Applauses! With these buttons every 
application can get a new, spicy and 
interesting look. 5 globes.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/16/2001 3:46:32 AM:JE
Good Job Man!! 5 s' for u
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/16/2001 6:23:42 AM:Dylan Morley
Excellent work, a very effective control
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/18/2001 8:03:09 AM:gonchuki
Another Update... it wasn't slow, but 
now is FASTER!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/20/2001 8:19:58 AM:Dylan Morley
One thing I've picked up on using this 
is the absence of a multi-line feature. 
With the standard VB button, if the 
caption-text is wider than the button 
and the button height allows it, the 
text will shift onto multiple lines. It 
would be nice to add in, if you have 
the time. 
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/24/2001 3:39:42 PM:Björn
Superb code and looks. Never seen 
better. 
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/29/2001 10:57:07 AM:gonchuki
next version coming soon...
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/30/2001 5:55:32 AM:MH
The XP Button is wrong. The blue border 
stands for default, not focus.
Look at 
the Windows XP Guidelines provided by 
Microsoft.
Hope you change it.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
1/3/2002 5:25:02 AM:Schoedler
Good work !!! You got 5 balls ... C'ya.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
1/3/2002 5:51:29 AM:Schoedler
Hey man! In the next version, how about 
insert pictures with customizable 
position (top, bottom, left, right) ??? 
Thanks and sorry my bad english !!!!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
1/4/2002 10:03:44 PM:shaohua
This is the work result I've ever 
dreamed of. Thanks god! You've just 
placed a stepping stone for every 
others who walks through it.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
1/5/2002 4:36:17 PM:Jon B. Mooty
There is a bug with the Font property.  
When you change any property of the 
Font object for the button the display 
is not updated with the new Font 
properties.  Just insert a cb.Font.Size 
= 28 into one of the button's click 
events to test it.  I have had this 
problem in some controls I have 
created.  I found a workaround but 
there has to be a better way.  Just let 
me know if you want to see it.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
1/22/2002 10:38:13 AM:schoedler
One suggestion ... Try to use the 
keybd_event API, no SendKeys. Win2k has 
a bug that freeze the keyboard using 
SendKeys VB function. Try no use With 
vb command ... It makes the code slow. 
C´ya !!!!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
1/22/2002 10:43:36 AM:schoedler
One little bug !!! When you set the 
ButtonType to [Java Metal] and after to 
another type, the font remain bold. Try 
use the follow code instead the 
If:
UserControl.FontBold = 
(MyButtonType = [Java metal])
One 
more thing: In the ButtonType (let), 
you read the ButtonType property ... 
Always use the local variable for the 
test ... Ex.:
Wrong:
If ButtonType 
= [Java metal] Then 
UserControl.FontBold = 
True
Correct:
If MyButtonType = 
[Java metal] Then UserControl.FontBold 
= True
Best Regards!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
1/22/2002 11:01:04 AM:schoedler
Hi again !!!
	I have found some 
performance tips ...
	In 
SetAccessKeys function, try to use Mid$ 
(with the $ ... this way the function 
returns a String value ... In Mid, the 
return is a variant ... 20% faster with 
Mid$!) ... Use also LCase$, UCase$, 
Str$, String$, Space$ ...
Best 
Regards!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
1/22/2002 11:23:12 AM:schoedler
Hey !
More one tip: if you want the 
control MORE faster, try to use the 
SendMessage API, using the WM_SETREDRAW 
option. Disabling the redraw, the 
system dont lost time redrawing the 
object !!!
Example:
'To disable 
the redraw
SendMessage 
UserControl.hwnd, WM_SETREDRAW, False, 
0&
'type here commands to draw in 
the object
'To re-enable the 
redraw
SendMessage UserControl.hwnd, 
WM_SETREDRAW, True, 
0&
UserControl.Refresh
C´ya 
!!!!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
1/23/2002 1:12:42 PM:Mika Viitapohja
GRRREEEAAAT CODE!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
1/31/2002 4:09:26 AM:Logan009
Hi, 
the dblclick should look like 
this (I added a line):
Private Sub 
UserControl_DblClick()
  If LastButton 
= 1 Then
    UserControl_Click
Call UserControl_MouseDown(1, 1, 1, 
1)
  End If
End Sub
That way, two 
fast clicks on the button will result 
in two click-Events.
Nevertheless: 
Good Work! Picture-Support would be 
good... :-))
Best 
regards,
Logan009@gmx.de
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/2/2002 8:42:24 AM:PROBLEM!
You get 5*s but there is a PROBLEM! 
When I have any kind of button once I 
click it once whenever I click the form 
(or outside of the form) instead of 
doing what it is supposed to (like if I 
click the [X]) the button will get 
pressed. And if i click on the form the 
button and evertthing else won't work.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/5/2002 7:53:34 AM:Kevin Meagher
Ok, not sure what the heck the guy 
above is trying to say.  Reading his 
comments is not incredibly easy on the 
eyes.  GREAT CODE!!  Latley I have been 
checking out posts from PSC LESS AND 
LESS due to the diminishing worth of 
these posts.  One more "fake e-mail" or 
"new trojan" and I think I'll puke, ha. 
 Anyway the code is absolutely 
excellent.  I like it so much I'm 
having difficulty deciding if I want to 
change out my buttons or not.  
SUGGESTIONS:  two things, a) graphic / 
picture support would be nice; b) 
"wrapping" should be added for captions 
longer than the width of the button.  I 
myself often use mult-line buttons.  5 
globes!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/5/2002 9:27:45 AM:Mac Guru
I'll be really impressed when it 
emulates a MacOS X button!  Woo hoo!  
Pretty cool as is, though.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/5/2002 10:18:11 AM:LCensoni
I think there's not much left to say...
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/5/2002 10:58:17 AM:Mohammad Asif
Is there any way to have a small 2nd 
caption on the button, say at a 
top-left corner. I am looking for ways 
to have a short-cut key indicator on 
the button but I don't like it part of 
the standard caption, or inside 
paranthese. Would it be easy for you to 
add this feature?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/6/2002 5:29:01 AM:schoedler
Hey gonchuki !!!
You can implement 
graphics support in the buttons and the 
"check-style" ...
What you think 
???
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/20/2002 12:40:01 AM:Al
What more can I say other than truley 
AWSOME!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/15/2002 6:37:10 AM:Eric
Great!!!
Max. globes.
Keep up the 
good work..
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/14/2002 2:56:30 AM:Zeven
very nice......
5 dogs for your very 
cool submission
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/14/2002 11:14:35 PM:Zeven
thanks for your code
I aready use it 
for my project
and its working
Very Awsome code!!!!
Greate job man
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/9/2002 12:55:22 AM:Adam
alhtough it is nice the windows xp 
buttons borders change to orange when 
the mouse is over the button.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/9/2003 8:23:20 PM:
excellent control keep it up
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | Visual Basic Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.