Hello! I am new here and I am stumped.
I have a matrix that I am scaling like this:
The label can be 1.0 to 2.0 in 0.1 steps. 1 is original Size and 2 would be 2x the original.Code:CursorMatrix.Scale(Single.Parse(LabelScale.Text), Single.Parse(LabelScale.Text), MatrixOrder.Append)
I am applying this to graphics. However, I shift the matrix depending on the scaling, as I want it centered to the screen. With this:
This works great. The image is enlarged, and as it enlarges down and to the right in the coordinates, the above code moves it up and left so its always centered.Code:Dim TranRepairX As Decimal = CenterOfRotation.X - ((LabelScale) * CenterOfRotation.X) Dim TranRepairY As Decimal = CenterOfRotation.Y - ((2 - LabelScale) * CenterOfRotation.Y) CursorMatrix.Translate(TranRepairX, TranRepairY, MatrixOrder.Append)
Here is where my problem is. When I draw on the image, the graphics are not going where the cursor is! I understand that this is because of the scaling. However, I cant figure out for the life of me how to get the graphics to go where the cursor is.
I did figure out that this would do it, but only when the scaling = 2:
But, it doesnt work with any other scaling value. Also, I have tried to transform the points like this:Code:NewPoint.X = e.X - (e.X - CenterOfRotation.X) / 2 NewPoint.Y = e.Y - (e.Y - CenterOfRotation.Y) / 2
I thought this would transform the points but they always come out to e.x,e.yCode:Dim NewCursorPoints As Point() = {New Point(e.X, e.Y)} CursorMatrix.TransformPoints(NewCursorPoints ) NewPoint.X = e.X - NewCursorPoints (0).X NewPoint.Y = e.Y - NewCursorPoints (0).Y
Any ideas!?




Reply With Quote