private void Form1_MouseMove(object sender, MouseEventArgs e)
{
//Create Graphics
Graphics g = this.CreateGraphics();
mx = Math.Floor(e.X / 32);
my = Math.Floor(e.Y / 32);
}
在Floor
和mx
中my
下获取错误(mx和我都是整数)
错误:严重性代码描述项目文件行抑制状态 错误CS0121以下方法或属性之间的调用不明确:'Math.Floor(decimal)'和 'Math.Floor(double)'GameAttempt3 c:\ users \ levyjrdesktop \ documents \ visual studio 2015 \ Projects \ GameAttempt3 \ GameAttempt3 \ Form1.cs 95 Active
答案 0 :(得分:6)
public static decimal Floor(decimal d);
public static double Floor(double d);
所以你需要施放:
mx = Math.Floor((double)e.X / 32);
my = Math.Floor((double)e.Y / 32);
答案 1 :(得分:2)