How to eliminate a "halo" in images with a transparent background

I use DrawImage () to draw some images in a form with a transparent background. Those images that are partially transparent cause a halo effect. (Look at the screenshot)

What is the best way to prevent this?

alt text http://www.imagechicken.com/uploads/1266798081003158300.png

EDIT

These same icons look great on my desktop, so there should be a better way to draw icons.

+3
source share
2 answers

, - , . , , .

, , , , .

+1

/ -? - , . , , - .


, "" , , . , "" :

public  class Form1 : Form
{
    Image newImage;

    public Form1()
    {
        this.BackColor = Color.Pink;
        this.ClientSize = new Size(168, 168);
        this.TransparencyKey = this.BackColor;

        newImage = Image.FromFile(Path.Combine(
               Environment.GetFolderPath(Environment.SpecialFolder.MyPictures),
               "dot-mac-logo.png"));
    }

    protected override void OnPaint(PaintEventArgs e)
    {
        e.Graphics.DrawImage(newImage, 20, 20);
    }
}

-. , #, C UpdateLayeredWindow MSDN , , - .

UpdateLayeredWindow # MSDN.

+1

Source: https://habr.com/ru/post/1733810/


All Articles