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 / Windows Forms / WinForm General / January 2007

Tip: Looking for answers? Try searching our database.

toolbar button with colour stripe

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
supremebeing@zoom.co.uk - 23 Jan 2007 23:50 GMT
Hi

Ok this is probably really easy and i am just being really stupid, but
how do you create a toolbar button similar to the highlight/fill or
Font button as seen in microsoft products where the colour stripe
changes depending on the colour selected.  I need to add a colour
button but i only want part of  the display to change to the selected
colour, i have tried different things out with transparency but i
either get a full button of colour or a colour border.

thanks in advance
Karyn
p.s. this is a c#.net 2.0 project
Ciaran O''Donnell - 25 Jan 2007 09:44 GMT
Couple of options here:
1) Have the image you use have transparent arears, then changing the
backcolor will show through them. This isn't good for changing small parts of
images with transparency.
2) Have a set of images in an image list which are all the different
possible images, then when the user selects the color (or whatever causes the
change) pull out the correct image and set it to the button. This isnt so
good for uses with a large number of possible settings.
3) Have 1 icon which is the one you want to display and either:
a) Pick a reserved color like a garish pink which you wont use in the icon,
set all the pixels that should change color to this color. Then when the use
picks the color, you can iterate through all the pixels (suggest unsafe
pointers here for speed) and change the ones which are the reserved color to
the chosen color. I think this is called 'color transplanting'
or
b) Have a second black and white (as in 1 bit per pixel) version of the icon
and iterate through that one setting all the pixels in the main image to the
user color which correspond to a white (or black) pixel in the second image.
This is called masking and allows you to use any colors in the main image.

I know the option used for making odd shape forms like media player is
masking but rather than changing the color it alters the region. This works
fast enough so I imagine it would be real quick for a little image like a
toolbar icon. definatly worth pinning the image and using pointers for moving
through the pixels though. There is a basic example here
:http://www.codeproject.com/cs/media/csharpgraphicfilters11.asp
for doing image filters but the invert filter should be a good starting
point for what you want.

HTH

Signature

Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com

> Hi
>
[quoted text clipped - 9 lines]
> Karyn
> p.s. this is a c#.net 2.0 project

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.