我有一个需要在运行时更改大小的图像,我想做的是当用户按下鼠标左键并且光标位于图像的边框上时,然后当他移动鼠标光标时图像大小根据光标所在的位置而变化。
这是我到目前为止所拥有的:
Point p = e.GetPosition(this);
Image img = (Image)e.Source;
var pos =Mouse.GetPosition(this);
if ((p.X == 89 && (p.Y > 204 && p.Y < 252)) || (p.Y == 245 && (p.X > 89 && p.X < 138)) || (p.Y == 213 && (p.X > 89 && p.X < 138)) || p.X == 138 && p.Y > 204 && p.Y < 252)
{
img.Width = p.X;
img.Height = p.Y;
}
问题是图像不会根据光标而改变。任何人都可以帮忙吗?