rotated e.x, e.y coordinates after Graphics RotateTransform

ridhwaans

Active member
Joined
Jun 1, 2012
Messages
34
Programming Experience
3-5
I am trying to write rotated text on the form using the e.graphics.drawstring method,
and after the following

e.Graphics.TranslateTransform(100.0F, 0.0F)
e.Graphics.RotateTransform(90.0F)

the coordinates I want to use (e.x, e.y) have changed because of the rotation, so the text appears at a different coordinate location
How can I make vb get the rotated coordinates?



shaperotationaltransfor.jpg
 
Just specify coords as if there was no transformation, when drawing through the transformed Graphics object what ever you draw will transform also. If you don't want to apply previous transformations call ResetTransform first.
 
Just specify coords as if there was no transformation, when drawing through the transformed Graphics object what ever you draw will transform also. If you don't want to apply previous transformations call ResetTransform first.

Sorry, it doesnt seem to be working
VB.NET:
Imports System.Drawing.Drawing2D
Imports System.Math

Public Class Form1

    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint

        e.Graphics.TranslateTransform(100.0F, 0.0F)
        e.Graphics.RotateTransform(90.0F)
        e.Graphics.DrawString("this is a test", New Font("Arial", 10, FontStyle.Bold), Brushes.Black, New Point(6, 6))
        e.Graphics.ResetTransform()
    End Sub

End Class

the string is supposed to appear at point(6,6) after the transformation is applied, but it appears at about point(84, 7)
 
Just specify coords as if there was no transformation, when drawing through the transformed Graphics object what ever you draw will transform also. If you don't want to apply previous transformations call ResetTransform first.

Nvm I got it,
my translate transform pivot point was wrong
 
Back
Top