Hi ,
Thanks for your suggestion. Now i can get the rotation matrix by manually and perform translation. But still my confusion in setting translation points alone.
Please find the code snippet below:
void ScaleAndRotate()
{
System.Drawing.Graphics formGraphics = this.CreateGraphics();
float width = formGraphics.MeasureString("Welcome", this.Font).Width;
formGraphics.DrawRectangle(new Pen(myBrush), 72f, 92f, 237.25f, 151.3f);
Matrix rotationMatrix = GetRotatingMatrix(270);
formGraphics.ScaleTransform(3f, 1);
rotationMatrix.Scale(3f, 1);
rotationMatrix.Translate(-17.4f, 324f, MatrixOrder.Append);
string text = "Welcome";
formGraphics.Transform = rotationMatrix;
formGraphics.DrawString(text, this.Font, myBrush, new RectangleF(83.5f, 94.99f, width, 13.44f));
}
In this code i have drawn one rectangle and get rotation matrix. If i reduce the drawstring method, rectangleF.X value as rectangleF.X /scaling value, its working good. But i dont want to reduce the rectangleF.X value.instead of that i need to construct exact transform matrix by performing matrix.translate method. Can you please help me?
No comments:
Post a Comment