WinForm transparent image issue - c#

I have a WinForm and I set a transparent PNG image for the label. In Windows XP, the transparency displays properly, but in Windows 7, the white text (as seen in the example URL below) becomes transparent (it should be solid white). I'm also wondering if there is a way to smooth the edges of the transparent image so it isn't as choppy.
label1.Image = global::WinProgram.Properties.Resources.image_name;
Example:

Due to your limited code, I'd be guessing on this one but i find this very likely to be your problem. In WinForms there is a so called TransparencyKey, I'm guessing that you sett'd the SolidWhite as your TransparencyKey.
You can refer to this post: Transparent Background

Related

How to make a Form of Winforms and pictureBox control display png images transparency without the outline?

I have an application using png type and GIF with transparency in the background. So I want to display them in Winforms using PictureBox, but they still have the outline or something outside the images that seem unclear as photoshop does. I have attached the example below.
As you guys can see the image has something outside that looks so annoying, can you guys help me figure out how to fix or improve It? I appreciate that.
Below is the original png that I used in my project
enter image description here
The problem is that the image is not fully transparent where you think it is.
The problem when taking an image and removing the background with transparency is that you often use the magic wand and it works for 99% but the rest you have to fix manually.
What I personally prefer in these cases is that you take your image (the png version with transparency) then in Photoshop you add another layer and put the first layer with the image on top. Then you change background color on the second layer (the one you just created) with a strange color in regards to the image, so in this case i would test with yellow.
Then if you have everything correct you should not see your image and since part of it is transparent you will see the yellow color where the image is transparent. Now you can zoom in and check the "strange parts" of the image and then you will find the spots that are not transparent. Now you can use the eraser or magic wand and polish the edges so that you only see yellow where it should be transparent. When you are done you could test and change the yellow color on the second layer to red and just double check. Then it will probably work as a charm. Good luck! If it does not work after that, please give us more details and also add the png image.

Image with transparency over video

Im using C# in VS2017 and have a Vlc Control to play a video.
I want to overlap some part of the video with a PNG image with transparency. In VS2017, elements are transparent to their parent. So, to make the image be transparent to the video I have to set it as child of the video.
But if I do that, the image doesn't display at all. Video is always refreshing and overlapping the image (even if I do a constant BringToFront in the image).
So, I change the Parent of the image to the form. Now the image displays, but through it's transparency I see the form's background, not the video.
Target platform is Windows. Is there any solution for this?
I had this same problem with windows forms. I believe there is no simple solution where you can use another control (e.g a picturebox) and make it transparent such that you can see the video behind it.
One thing you can do is to create another form, set it as topMost, set it's MDiParent to the form containing the VLC control and set its FormBorderStyle to None. Then set it's background to be the image you want to overlay and set it's opacity property to say 50%. This should give you the effect you want but it is a bit of a work around.
If you can you should move to WPF as your UI technology which should solve this and allow you to overlay a picture box with a transparency that doesn't just show the background of the main form behind it and actually shows the video.
It's not very clear how you're using libvlc.
Do you have to blend the image with the control itself? Shouldn't you blend any given image with the video frames?
If so, try using --alphamask-mask filter:
--alphamask-mask=<string>
Transparency mask
Alpha blending transparency mask. Uses a png alpha channel.
If you're using libvlc.net you can do this by adding an option:
vlcContext.StartupOptions.AddOption(<options>);

C# proper image alpha layer when form is invisible

I'm looking for a way to have images on invisible form that allow alpha transparency and allow to place and use buttons/labels etc.
I've tried this Transparent background on winforms?, layered window and many more, nothing fully successful. I've ended up with such failures http://imgur.com/a/t6nmF
Transparency key only makes one color transparent, which doesn't work on images that have smooth color gradients on the edges.
First of all, are you certain that your image has a transparent background?
Layered window is exactly what you should use to achieve the desired effect. Since you don't give much details, I don't know what's wrong with your implementation. Try to use the PerPixelAlphaForm from the following article: Per Pixel Alpha Blend in C#. When used correctly, it will work (even though the article is really old).

Words in transparent PNG have jagged edges

I've built an app which uses transparent PNGs to display an overlay for users to tap using WPF and C#. However, there are weird jagged edges around the words. Would this be more of a C#/WPF limitation or a Photoshop issue?
Screen resolution is 720p. App runs on win7pro.
Screenshot:
Definitely a problem with the image itself. I see the same fringing when viewing the image against a black background on my phone. Make sure you compose the text over a transparent background (i.e., don't remove the background with a magic wand tool) and save with a full alpha channel (32-bit PNG).

Cant get drop shadow as per PNG image in C# background image of form

I've form in .net C#,
Problem:
I've a PNG image with drop shadow and I want put that image as back ground image of form and also using transparency key as well with the same background color property. But when I debug my app it does not give expected drop shadow as per png image. Please help me.
You'll probably need to programmatically adjust the transparency of the image.
Background images on a form do not support any photo attributes/editing, just set or get. So you'll need to get your photo and the background color of the form, and then programmatically change the photo to look as if it is transparent to the background color of the image.
Then take the image and set it as the background image of the form.
But without more information, I'm not sure what else to say or if I've said the right thing.
I have a better solution.
ModernUI Theme for .Net WinForms supports two kinds of Shadow Effects. See
image below.
WinForm ModernUI
It's under MIT on GitHub:
https://github.com/NetDimension/WinForm-ModernUI

Categories