c# - Slow Line drawing in GDI+ -


i'm new winforms , gdi+, come wpf background. using simple code below draw 1000 lines noticed doesn't draw lines @ once wpf does. slow , process of drawing noticable. missing in code below?

private void button1_click(object sender, eventargs e) {     graphics g;     g = creategraphics();      var pn = new pen(color.wheat, 1);     var x = 0;     var y = 0;     var n = 0;      while (n < 1000)     {         x = x + 5;         if (x > 1200)         {             x = 0;             y = y + 15;         }         g.drawline(pn, x, y, x, y + 10);          n++;     } } 

i've created small solution compare drawing speed, can try on own machine.

link solution


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -