如何移动Label控件(加分100)在线等,紧急!!! 如何在Timer控件的帮助下,让Label慢慢的移动到任意的坐标点.(比如鼠标点击的坐标点) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 应该找到你鼠标点击的坐标,然后再根据控件本身的坐标,按照你的意思(慢慢),计算出每次移动后的坐标,在TIMER中进行对控件位置的重新设置。 窗体有个MouseUp或用MouseDown在方法里:e.x,和e.y可以获得鼠标点击的坐标然后在一个timer事件里把label的location的x,y值一点一点的加到获取的坐标值最后在MouseUp或MouseDown里调用timer 用js做style的坐标,就可以移动 首先 MouseClike 方法 取得参数 MouseEvent e 的 e.X E.Y 就是坐标设定 Int mx,my 存储坐标在timer的计时动作中添加代码if(label.left<mx){ label.left+=1}else{ label.left -= 1}if(label.top>my){ label.top-=1}else{ label.top+=1} 主要的代码在这里private void timer1_Tick(object sender, System.EventArgs e){if(this.label1.Location.X<this.X)this.label1.Location = new System.Drawing.Point(this.label1.Location.X+1,this.label1.Location.Y);if(this.label1.Location.Y<this.Y)this.label1.Location = new System.Drawing.Point(this.label1.Location.X,this.label1.Location.Y+1);}private void Form1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e){ this.X = e.X; this.Y = e.Y; this.timer1.Start();} C# 图片滚动显示 超郁闷的问题,难道是打了补丁? 使用WebRequest方法post数据到aspx,怎样解决viewstate问题? 数据库字段加密的问题 找出成绩最高的学生号和课程号 如何在remoting的配置文件中标明,传输的格式标示??即,标明到底是要传输二进制还是soap 其他FORM调用另一个FORM中的控件 关于ESC事件的处理问题,谢谢 您未被授权查看该页 Main方法可不可以有返回值?为什么? 有人知道 TabIndex怎么用吗 有谁用过Infragitics产品的WinUltraGrid控件,可知道其最佳列宽和最佳行高是哪两个属性?
在方法里:e.x,和e.y可以获得鼠标点击的坐标然后在一个timer事件里把label的location的x,y值一点一点的加到获取的坐标值最后在MouseUp或MouseDown里调用timer
{
label.left+=1
}
else
{
label.left -= 1
}
if(label.top>my)
{
label.top-=1
}
else
{
label.top+=1
}
private void timer1_Tick(object sender, System.EventArgs e)
{
if(this.label1.Location.X<this.X)
this.label1.Location = new System.Drawing.Point(this.label1.Location.X+1,this.label1.Location.Y);
if(this.label1.Location.Y<this.Y)
this.label1.Location = new System.Drawing.Point(this.label1.Location.X,this.label1.Location.Y+1);
}private void Form1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.X = e.X;
this.Y = e.Y;
this.timer1.Start();
}