I've created a graph(Diagram) on PictureBox control. This control has the ability to zoom/pen. When I want to zoom, it slows down.
Thanks for helping someone
public void Render(bool resizeToo = false)
{
if (resizeToo)
{
plt.settings.Resize(pb.Width, pb.Height);
if (plt2 != null)
{
plt2.settings.Resize(plt.settings.width, plt.settings.height);
}
}
if (plt2 == null)
{
pb.Image = plt.figure.GetBitmap();
}
else
{
// if plt2 contains a GraphControl, match its X axis to the user control then overlay it
plt2.settings.axisX.Set(plt.settings.axisX.x1, plt.settings.axisX.x2);
Bitmap bmp1 = plt.figure.GetBitmap();
Bitmap bmp2 = plt2.figure.GetBitmap();
Bitmap bmpMerged = new Bitmap(bmp1);
using (Graphics gfx = Graphics.FromImage(bmpMerged))
gfx.DrawImage(bmp2, new Rectangle(0, 0, bmp2.Width, bmp2.Height));
pb.Image = bmpMerged;
}
Application.DoEvents();
}