GDI+ and mouse coordinates

InertiaM

Well-known member
Joined
Nov 3, 2007
Messages
663
Location
Kent, UK
Programming Experience
10+
Is there a simple way to convert mouse coordinates based on the current Scale and Transform values? For example, if I do :-

VB.NET:
    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        With e.Graphics
            .ScaleTransform(0.45, 0.45)
            .TranslateTransform(-750, -750)

            'store the transform matrix here
        End with
    End Sub

how do I then use the transform matrix to calculate the mouse coordinates from

VB.NET:
    Private MouseLocation As Point

    Private Sub frmMain_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
        MouseLocation = e.Location

        'apply the transform matrix to the mouse location here

    End Sub

:confused:
 
Back
Top