locked
Issue with Color.FromArgb? RRS feed

  • Question

  • I'm drawing a polygon on a qPanel on the tab of my Add-in. Nothing weird:

     

    Code Block

    SolidBrush brush1 = new SolidBrush(Color.FromArgb(50, Color.Red));

     

    g.FillPolygon(brush1, new Point[]{ <points go here > }

     

     

    Which works fine in a test form, run from my Windows XP machine. However when I run the test app on WHS (or render the polygon in the Add-in), the alpha is not used; rather the polygon is rendered cross-hatched (which looks nasty).

     

    According to MSDN, Windows Server 2003 supports FromArgb.

     

    What am I missing or doing wrong?

    Saturday, January 12, 2008 5:07 AM
    Moderator

Answers

  • Draw off-screen in a bitmap, then slap the finished bitmap into a picture control.

     

    Code Block

    Bitmap bitmapRenderServerImage = new Bitmap(290, 400);

    Graphics g = Graphics.FromImage(bitmapRenderServerImage);

    <render polygons here>

    this.pictureBoxServer.Image = bitmapRenderServerImage;

     

     

    Saturday, January 12, 2008 5:57 AM
    Moderator

All replies

  • Progress. It's an issue related to Terminal Services/Remote Desktop. The alpha is rendered correctly when I'm on the physical console with a monitor and keyboard.

     

    Well, let's change the question then: what can I use instead of an alpha value to get some transparency effects with brushes?

    Saturday, January 12, 2008 5:30 AM
    Moderator
  • Draw off-screen in a bitmap, then slap the finished bitmap into a picture control.

     

    Code Block

    Bitmap bitmapRenderServerImage = new Bitmap(290, 400);

    Graphics g = Graphics.FromImage(bitmapRenderServerImage);

    <render polygons here>

    this.pictureBoxServer.Image = bitmapRenderServerImage;

     

     

    Saturday, January 12, 2008 5:57 AM
    Moderator