Aero: How to draw solid (opaque) colors on glass?

前端 未结 6 821
孤独总比滥情好
孤独总比滥情好 2020-11-30 03:02

Using GDI+ to draw various colors:

brush = new SolidBrush(color);
graphics.FillRectangle(brush, x, y, width, height);

You\'ll notice that n

6条回答
  •  死守一世寂寞
    2020-11-30 03:42

    Seems to work OK for me. With the lack of a full code example I'm assuming you've got your compositing mode wrong.

    public void RenderGdiPlus()
    {
        List colors = new List(new string[] { "000000", "ff0000", "00ff00", "0000ff", "ffffff" });
        List alphas = new List(new string[] { "00", "01", "40", "80", "c0", "fe", "ff" });
        Bitmap bmp = new Bitmap(200, 300, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
    
        Graphics graphics = Graphics.FromImage(bmp);
        graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
        graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.None;
        graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;
    
        graphics.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy;
        graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
        SolidBrush backBrush = new SolidBrush(Color.FromArgb(254, 131, 208, 129));
        graphics.FillRectangle(backBrush, 0, 0, 300, 300);
    
        graphics.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver;
        Pen pen = new Pen(Color.Gray);
        for (int row = 0; row < alphas.Count; row++)
        {
            string alpha = alphas[row];
            for (int column=0; column

提交回复
热议问题