Image display incorrect on toolstrip - c#

I use a 32-bit image & use it as a value for Image property of ToolStripButton. But I don't know why it displays unlike the original one.
This is the screenshot:
http://img4.imageshack.us/img4/7668/34711163.png http://img4.imageshack.us/img4/7668/34711163.png
And my project:
http://www.mediafire.com/?3mzmf5r5nnx
Please help me to find the reason. Thanks.

I've opened the 'button_9.png' in Paint.NET and it seems like the 'white glass' of the magnifier is semi-transparent.
So you have to edit the image that the magnifier has an opaque backcolor.

Related

Adding an icon to right-to-left ListView items causes the icons to flip in C# WinForms

I have a ListView. Its RightToLeft property is set to Yes and its RightToLeftLayout is set to True. The ListView is populated with files in a directory.
In my code, I get the appropriate icon of a file using System.Drawing.Icon.ExtractAssociatedIcon(string filePath) and assign it to the file. This means that the icon come directly from the operating system. I do not have a directory with custom icons.
So the result is this:
As you can see, the PowerPoint file icon is flipped. When I change the layout to LeftToRight it is shown perfectly. How can I fix it?
Thanks.
If you only need the icon to be reversed, I suggest putting it into a Bitmap then using the Bitmap.RotateFlip you can flip it horizontally.
Bitmap bm = System.Drawing.Icon.ExtractAssociatedIcon(string filePath).ToBitmap();
bm.RotateFlip(RotateFlipType.RotateNoneFlipX);

How to use a default image icon for a UIButton instead of a UIBarButton item

As seen by the screen shots below. I am using a UIBarButton item to use a search icon as an image:
The image below shows that I am using a toolbar to use the image button.
This is how the bar button item is identified as a search icon.
The problem: How do I do the same thing for a UIButton?
I've tried doing this programmatically or through the interface builder but cannot find anyway to do do the same thing. I know I can use a background image for the UIButton, but I want to simply choose the identifier like a UIBarButton. Is there any way to do this?
No, UIButton has a very limited list of default icons, unlike the UIBarButtonItem. The search icon is not one of them. These are available as enum values of UIButtonType:
UIButtonTypeDetailDisclosure
UIButtonTypeInfoLight
UIButtonTypeInfoDark
UIButtonTypeContactAdd

Imagebeforetext does not center button contents

I'm using Windows Forms.NET.
I've configured a button in the following way:
ImageAlign: MiddleCenter
TextAlign: MiddleCenter
TextImageRelation: ImageBeforeText
The problem is, when I make button wider than usual, its contents are no longer centered:
Why is it so? How can I correct it?
I think the Text and Image share 2 even parts of the Button Client area horizontally. So if you set the TextImageRelation as OverLay, ImageAboveText, TextAboveImage they should be what we expect. But for other values, they act differently. I think that's by design.
To solve your problem, I have tried changing ImageAlign to MiddleRight and it works as what you want.
Again, I think that's by design. :)

Showing image / text on screen without forms in c#

How can I show something on screen wihtout using forms?
Actually, I want to show some text and images popping on screen.
EDIT: just like i said HERE
What you can do is to create a alphatransparent form that draws the PNG and position it at the correct location and bind move etc.
http://www.codeproject.com/KB/GDI-plus/perpxalpha_sharp.aspx
PerPixelAlphaForm transparentImageForm = new PerPixelAlphaForm();
transparentImageForm.SetBitmap(<IMAGE GOES HERE>,<OPACITY GOES HERE>);
//opacity is the opacity that the image will be drawn with, a value of 255 = all transparent parts will be alpha/transparent just as much as the original PNG etc..
and you can put a timer that calls SetBitmap and changes the Opacity to fade in/out the image on the screen
And you can generate the text (on the fly) in a nice way with code from THIS article
and pass that image to the SetBitmap of the AlphaTransparent form.
EDIT: OR GO TO WPF.
I don't think you can: a form is equivalent to a window, and Windows applications draw into a window and not directly onto the screen (unless perhaps it's the backgroun/wallpaper, which I don't know about).
I think that's overdoing it but XNA will allow you to draw to the screen, but it is meant to be used for games so you will have trouble fitting it to a normal application.

.Net & C#: Trying to have a transparent image on a button (assigned from IDE)

Using VS2005 and C#.
Having a button in a form and an image from a resource, the image does not have transparency.
How can I have transparency when assigning the image from the IDE ?
Thank you.
Open the image in an image editor (Paint.NET and GIMP are free) and add the transparencies wherever you need to.
It will all work once the image actually has transparent pixels.
You can also use a couple methods of the Bitmap class to do this:
Bitmap b = Properties.Resources.MyImage;
b.MakeTransparent(b.GetPixel(0, 0));
I don't really understand what you are asking. You can use an image with transparency on a button as long as the image type you are using supports transparency - such as .png.
Edit: I read your question again and it is still confusing, but maybe you meant to say that you want to add transparency to the image? If so, you would have to use an image editor to add the transparency and save it in a format that supports this. Paint.Net is a good free tool for this.

Categories