用GRAPH画图进行坐标转换后如何取出鼠标所在点的对应坐标
Grap.TranslateTransform(0, pictureBoxGraph.Height - 1); Grap.ScaleTransform(1, -1);------------------------------- if (IsDrawing && e.Button == MouseButtons.Left && !IsImgMove) { //将数据点存储以便画线 _DrawLine.Add(new Point(e.X, e.Y)); }
{ Grap.TranslateTransform(0, pictureBoxGraph.Height - 1); Grap.ScaleTransform(1, -1); this.matrix = Grap.Transform; // 得到转换矩阵 this.matrix.Inverse(); // 得到逆转换}System.Drawing.Drawing2D.Matrix matrix = new Matrix();void Form1_MouseDown(object sender, MouseEventArgs e){ Point[] points = {e.Location}; this.matrix.TransformPoints(points); //<-- this.Text = points[0].ToString();}
[解决办法]
Matrix Transform
看这个,http://nonocast.cn/?p=2835