Shapes With Stroke

Posted by: brian on 7 October 2020, 9:52 am EST

    • Post Options:
    • Link

    Posted 7 October 2020, 9:52 am EST

    I’d like to draw a rectangle (and circle) with a stroke. I accomplish it fine by first calling FillRoundRect, then DrawRoundRect. But if I put a transparency on the color, I’m not getting the expected result, do you have any suggestions? In practice, the “radius” parameter of 10 is a variable, along with the color and size…but hopefully you see what I’m talking about.

    using (var bmp = new GcBitmap(200, 200, false)) {
      using(var g = bmp.CreateGraphics(Color.White)) {
        var rect = new RectangleF(20, 20, 160, 160);
        g.FillRoundRect(rect, 10, Color.FromArgb(100, Color.Red));
        g.DrawRoundRect(rect, 10, Color.FromArgb(100, Color.Black), 10, DashStyle.Solid);
      }
      bmp.SaveAsPng(@"D:\Temp\EditorTests\_Output\grape_demo.png");
    }
    ```[img]https://gccontent.blob.core.windows.net/forum-uploads/file-0eb1a936-cb27-4f27-9263-d8376abbec86.png[/img]
  • Posted 8 October 2020, 9:56 pm EST

    Hi Brian,

    >>if I put a transparency on the color, I’m not getting the expected result.

    Sorry we do not face the issue at our end and the screenshot that you have attached seems to be fine to me.

    The max value of transparency is 255 and the minimum will 0. I have attached some set of screenshots with different transparency value, please look into it for more clarity.

    If you meant something else then please let us know in brief.

    Regards,

    Prabhat Sharma.

    Images.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels