Hi, I wonder why normal graphics speed is much slower than VB6 in C # code, here is an example code that does the same in VB6 and C #, it takes 1.7 seconds in VB6 on my computer and 4.2 seconds in C # Can someone please tell me why and also if there is a better and faster way in C #.
thank
C # code
Bitmap MyBitmap = new Bitmap(1024, 768);
Graphics g = Graphics.FromImage(MyBitmap);
DateTime STime = DateTime.Now;
Pen MyPen = new Pen(Color.Black);
for (int i = 0; i < 100000; i++)
{
g.DrawLine (MyPen, 0, 0, 1024, 768);
}
MessageBox.Show(DateTime.Now.Subtract(STime).TotalMilliseconds.ToString());
VB6 Code:
Me.AutoRedraw = True
t = Timer
For i = 1 To 100000
Me.Line (0, 0)-(1024, 768), 0
Next
MsgBox (Timer - t)
source
share