public void RotateImage(Graphics paper,string theString)
{
try
{
using (paper)
{
paper.RotateTransform(angle);
angle++;
sz = paper.MeasureString(theString, this.Font);
paper.DrawString(theString, new Font("Arial", 24), Brushes.Black, -(sz.Width / 2), -(sz.Height / 2));
paper.Dispose();
}
}
catch (Exception e) { MessageBox.Show(e.ToString()); }
i get an error saying parameter is not valid, but only if i call my method for the second time in the paint method
private void Form1_Paint(object sender, PaintEventArgs e)
{
RotateImage(e.Graphics, "A");
RotateImage(e.Graphics, "B");
}
if i call it once , the error will not happen.
private void Form1_Paint(object sender, PaintEventArgs e)
{
RotateImage(e.Graphics, "A");
}