-2

How can I draw a tick (check mark) in C#? I am having trouble figuring out how to connect the points from top to bottom and then from top to right. I am using WinForms and GDI+

0

1 Answer 1

1

The simplest way would be to just draw two separate lines. One pointing down, and to the right, and the second, pointing up, and to the right. The second line would "start" where the first line ends. You can figure out the calculations yourself very easily, once you have decided on the size of your checkmark.

paintEventArgs.Graphics.DrawLine(new Pen(Color.FromArgb(13, 13, 13), 1),
            7, 15, 11, 18);

paintEventArgs.Graphics.DrawLine(new Pen(Color.FromArgb(13, 13, 13), 1),
    11, 18, 18, 10);
4
  • ok but do you have documents for this? I am finding it hard too find the right source material for drawing in gdi
    – Sole
    Apr 1, 2016 at 13:01
  • @Sinatr What's the problem?
    – delete me
    Apr 1, 2016 at 13:01
  • this is working jase but please can you help me find the source material?
    – Sole
    Apr 1, 2016 at 13:02
  • @Sole Ok, so here's a link to some documentation: msdn.microsoft.com/en-us/library/aa984364(v=vs.71).aspx.
    – delete me
    Apr 1, 2016 at 13:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.