用图形坐标系成功地将鼠标坐标系替换为变换矩阵。
Mouseout.X = e.X;
Mouseout.Y = e.Y;
PointF[] myArray =
{
new PointF(Mouseout.X,Mouseout.Y)
};
Matrix haha = new Matrix();
haha.RotateAt(-(float)angle, Cen, MatrixOrder.Append);
haha.Translate(MoveMouseMatrixX, MoveMouseMatrixY, MatrixOrder.Append);
haha.TransformPoints(myArray);
MouseLocation = myArray[0];
但是,通过拖动移动的坐标和鼠标的坐标不匹配。无法实时读取移动的鼠标坐标。
GetCursorPos(out LastLocation);
float moveX = (CurrentLocation.x - LastLocation.x);
float moveY = (CurrentLocation.y - LastLocation.y);
st.X -= moveX / 2;
st.Y -= moveY / 2;
le.X += moveX;
le.Y += moveY;
Cen.X -= moveX / 2;
Cen.Y -= moveY / 2;
MoveAngle.X += moveX / 2;
MoveMatrixX -= moveX / 2;
MoveMatrixY -= moveY / 2;
MoveMouseMatrixX += moveX / 2;
MoveMouseMatrixY += moveY / 2;
CurrentLocation = LastLocation;