C#无边框窗体代码问题
privatePointmouse_offset;privatevoidform_MouseDown(objectsender,EventArgse){mouse_off...
private Point mouse_offset; private void form_MouseDown(object sender, EventArgs e) { mouse_offset = new Point(-e.X, -e.Y); } private void form_MouseMove(object sender, EventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Left) { Point mousePos = Control.MousePosition; mousePos.Offset(mouse_offset.X, mouse_offset.Y); this.Location = mousePos; } } 报错错误 1 “System.EventArgs”并不包含“X”的定义 d:\test\vc\WindowsApplication6\WindowsApplication6\Form1.cs 25 41 WindowsApplication6 错误2 “System.EventArgs”并不包含“Y”的定义 d:\test\vc\WindowsApplication6\WindowsApplication6\Form1.cs 25 47 WindowsApplication6 错误3 “System.EventArgs”并不包含“Button”的定义 d:\test\vc\WindowsApplication6\WindowsApplication6\Form1.cs 30 19 WindowsApplication6 我该怎么该?? e.X e.Y Button怎么定义 书上面没写定义啊
展开
1个回答
展开全部
private void Form1_MouseDown(object sender, MouseEventArgs e) { mouse_offset = e.Location; } private void Form1_MouseMove(object sender, MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Left) { Point mousePos = Control.MousePosition; mousePos.Offset(mouse_offset); this.Location = mousePos; } }
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询