Hi,

I dont know what I am doing wrong here but for some reason the graphics path does not rotate properly, I have created a user control that loads in a graphics path and will scale the path to the size of the user control which is fine, but when I go to rotate the path the rotation goes all wrong, could someone please look at my code? if you want my sample project I will send it.

VB Code:
  1. protected override void OnResize(EventArgs eventargs)
  2.         {
  3.             base.OnResize(eventargs);
  4.             DrawPath();
  5.         }
  6.  
  7.         private void DrawPath()
  8.         {
  9.             Bitmap b = new Bitmap(this.Width, this.Height);
  10.             Graphics e = Graphics.FromImage(b);
  11.             if (Mainpath != null)
  12.             {
  13.                 try
  14.                 {
  15.                     float x = 0f;
  16.                     float y = 0f;
  17.                     x = (this.Width) / ((float)Mainpath.GetBounds().Width + 1);
  18.                     y = (this.Height) / ((float)Mainpath.GetBounds().Height + 1);
  19.                     Matrix m = new Matrix();
  20.                     m.Scale(x, y);
  21.                     Mainpath.Transform(m);
  22.  
  23.  
  24.                     e.DrawPath(new Pen(Color.Black), Mainpath);
  25.                     this.BackgroundImage = b;
  26.                 }
  27.                 catch { }
  28.             }
  29.         }
  30.  
  31.         private void Rotate(float Value)
  32.         {
  33.             try
  34.             {
  35.                 Matrix m = new Matrix();
  36.                 m.RotateAt(Value, new PointF(this.Width /2,this.Height / 2));
  37.                 Mainpath.Transform(m);
  38.                 DrawPath();
  39.             }
  40.             catch { };
  41.         }
  42.  
  43.         private float m_RotateAnglePath;
  44.  
  45.         public float RotateAnglePath
  46.         {
  47.             get { return m_RotateAnglePath; }
  48.             set
  49.             {
  50.                 m_RotateAnglePath = value;
  51.                 Rotate((int)RotateAnglePath);
  52.             }
  53.         }

Thanks

Loftty