title: Changing the point of Rotation of an Object
body: <p>I have an object that I can rotate and resize etc using GDI+ and transforms.  The rotation point can be dragged so that it is at any point. Resize &amp; rotation works fine, except for one feature.</p>
  
  <p>What I'm struggling to work out how to do with transformations is how to take an object that is already rotated about a rotation point, then move that rotation point and for the object to stay at it's current position (just the rotation point has moved). Visio does this nicely!</p>
  
  <p>I presume the top left origin is changing on the object (when not rotated) or the angle is changing?</p>
  
  <p>Can anyone advise possibly with an example if possible as this is driving me nuts;  I'm sure it's simple but cant find a solution in this forum.  Anyone done before out there?</p>
  
  <pre><code>' Setup Variables
  Dim OrigLocation as Point = .....
  Dim OrigRotationAt as PointF = .....
  Dim NewRotationAt as PointF = .....
  Dim Rotation as Single = .....
  
  ' Matrix Transformation
  Dim TransPoints As Point() = New Point() {OrigLocation}
  Dim mat As New Matrix
  mat.Translate(OrigLocation.X, OrigLocation.Y, MatrixOrder.Append)
  mat.RotateAt(Rotation, OrigRotationAt, MatrixOrder.Append)
  mat.RotateAt(-Rotation, NewRotationAt, MatrixOrder.Append)
  mat.Translate(-OrigLocation.X, OrigLocation.Y, MatrixOrder.Append)
  mat.TransformPoints(TransPoints)
  mat.Dispose()
  
  ' Set New Location
  Dim NewLocation as Point = TransPoints(0)
  </code></pre>
  
  <p>Regards</p>
  
  <p>Julian Wigman</p>