I've been asked to give my .NET app the same look and feel to another app written using Java/Swing.
My main issue is to do with button/icons. The JButton used by the other app has an icon with a transparent background - this may a consequence of using GIF as the source format.
Now I just want to knock-up some simple icons for my app using VS2005 image editor and add them to the buttons. Cannot see how to add transparent pixels.
<gripe>
The icon editor has a transparent colour but the image editor doesn't! Guess this is to do with the file format but if the Bitmap class has a MakeTransparent method, why doesn't the editor?
</gripe>
Some buttons have state so I need an imagelist.
How do I create an Imagelist using VS2005? (Not programmatically)
9 1965
There is no such thing as a transparent pixel, a color appears transparent when its opacity is set below 100%. I have never used VS2005 image editor, but I guarantee you wont end up with the effect unless you start with a transparent background - no colors - and can adjust the opacity of subsequent layers.
Btw - does anyone know the speed of dark? ;).
Generally speaking a "transparent pixel" just means that for that particular pixel, nothing is done to it when your picture is drawn.
If it was already "red" it stays red, "blue" stays blue and so on.
You could make (234,254,244) be your "invisible" color just by not drawing it.
Ok guys we've gone overboard on my use of the phrase "transparent pixel". You know what I'm after - I need the image to blend nicely with the button its sitting on, just like icons do on the toolbar,menus etc..
My buttons have:
BackColor
BackgroundImage
BackgroundImageLayout
Image
ImageAlign
ImageIndex
ImageKey
ImageList
FlatSyle
FlatAppearance
TextImageRelation
Seems like you should be able to accomplish your goals with those properties
Generally speaking a "transparent pixel" just means that for that particular pixel, nothing is done to it when your picture is drawn.
If it was already "red" it stays red, "blue" stays blue and so on.
You could make (234,254,244) be your "invisible" color just by not drawing it.
Sorry, a pixel is a unit of measurement. Whether it is transparent or not depends on whether anything translucent is covering it, another layer. That's why your transparent pixel is not transparent at all, it is empty. What is transparent are the layers above it.
Ok - if white noise isn't silent how much does nothing weigh? :)
Well I've tried: -
private void MainForm_Load(object eventSender, System.EventArgs eventArgs)
-
{
-
-
foreach (Bitmap bmp in MyButton.ImageList.Images)
-
{
-
bmp.MakeTransparent(bmp.GetPixel(1, 1));
-
}
-
But this had no effect. Further suggestions?
Ok so you are assigning that color in the (1,1) location be the transparent color.
That's only for that EXACT RGB value (so if you have fancy color blending then it won't work)
And are you assigning those images as the background image?
You basicly want buttons that are customly shaped in the shape of your images right?
Ok so I have finally found the key property.
It's ImageList.TransparentColor.
Now, the default for is Transparent (!). I could change this to something else and fill my image with that where needed (which is how I know it works) but it would make more sense to use this Transparent. Any idea how to get it into the image editor in VS2005? Some experimentation shows the alpha channel is set to 0, how to do that in VS2005 image editor?
Add image to project.
Open image.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jeff T. |
last post by:
Hi,
I have a JMenuBar object that contains a JToolBar object which contains
some JButton objects. After I let my applet sit for > 20 minutes, the
graphics on those buttons would disappear. ...
|
by: Konrad Den Ende |
last post by:
Is it possible to do at all? The software will be used on computers
with western operative systems (so i guess, JVM will be english)
but i'm asured that japanese will be enabled through IME so that...
|
by: porky008 |
last post by:
I put in a next and previous button but it crashes when I run it. I also need it to loop around to the first or last if at the ends. Can some one help me with this?
import java.awt.*;
import...
|
by: Oswald Otte |
last post by:
Hello
How can I change the look of a disabled JButton? I have made a boardgame
with a brown background and brown buttons. I have also put an imageicon on
the buttons that has a colored image on...
|
by: vijaykumarsharma |
last post by:
Hi all
I am having a problem with JButton.
JButton b=new JButton("save");
how can i get the name of the JButton b.
Please give the anser for me
|
by: sokeefe |
last post by:
I am trying to edit the GUI of a project in Netbeans. In particular, I am trying to add new JButtons. I get a NullPointerException when I try to add an Event to any given JButton (even ones that...
|
by: sokeefe |
last post by:
I am trying to edit the GUI of a project in Netbeans. In particular, I am trying to add new JButtons. I get a NullPointerException when I try to add an Event to any given JButton (even ones that...
|
by: yeshello54 |
last post by:
So I want to set the background color of a Jbutton. I know that the normal way to do such a thing is down the following way:
JButton button = new JButton("xxxx");
button.setBackground(Color.RED);...
|
by: mlibot |
last post by:
My JButton will be disabled when running my program... my JButton will be enabled if the value or parameter are equal to 3...
for example: 1 value is path of the file i selected.
2 vaue is path of...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |