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:
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); } }
Thanks
Loftty




Reply With Quote