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.
Comments
Post a Comment