protected override void OnResize(EventArgs eventargs)
{
base.OnResize(eventargs);
DrawPath();
}
private void DrawPath()
{
Bitmap b = new Bitmap(this.Width, this.Height);
Graphics e = Graphics.FromImage(b);
if (Mainpath != null)
{
try
{
float x = 0f;
float y = 0f;
x = (this.Width) / ((float)Mainpath.GetBounds().Width + 1);
y = (this.Height) / ((float)Mainpath.GetBounds().Height + 1);
Matrix m = new Matrix();
m.Scale(x, y);
Mainpath.Transform(m);
e.DrawPath(new Pen(Color.Black), Mainpath);
this.BackgroundImage = b;
}
catch { }
}
}
private void Rotate(float Value)
{
try
{
Matrix m = new Matrix();
m.RotateAt(Value, new PointF(this.Width /2,this.Height / 2));
Mainpath.Transform(m);
DrawPath();
}
catch { };
}
private float m_RotateAnglePath;
public float RotateAnglePath
{
get { return m_RotateAnglePath; }
set
{
m_RotateAnglePath = value;
Rotate((int)RotateAnglePath);
}
}