Bitmap OyunAlani = new Bitmap(400, 400);
private void Form1_Load(object sender, EventArgs e)
{
backgroundWorker1.RunWorkerAsync();
}
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
ilerle();
}
void ilerle()
{
while (true)
{
Size size = new Size();
size.Width = 7;
size.Height = 7;
Image i = (Image)OyunAlani;
pictureBox1.Image = ZoomPicture(i, size);
System.Threading.Thread.Sleep(10);
}
}
Image ZoomPicture(Image img, Size size)
{
int genislik = Convert.ToInt32(img.Width * size.Width);
int yukseklik = Convert.ToInt32(img.Height * size.Height);
Bitmap bm = new Bitmap(img,genislik, yukseklik);
Graphics gpu = Graphics.FromImage(bm);
gpu.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
return bm;
}
My goal is to zoom a picture in a loop. I searched all topics about this problem but Dispose is not working. What should i do ? or alternative zoom solution?
Error is
System.ArgumentException 'parameter is not valid.'