C#文字跟随鼠标移动效果
WinForm中,左击后鼠标右侧会出现文字,会跟随鼠标一起移动。放开后效果消失。如有回答可行者必有重赏!...
WinForm中,左击后鼠标右侧会出现文字,会跟随鼠标一起移动。放开后效果消失。如有回答可行者必有重赏!
展开
1个回答
展开全部
算法出来了:
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
this.label2.Location = new Point(e.X + 10, e.Y);
this.label2.Text = "当前坐标:"+e.X + "," + e.Y;
}
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
if(e.Button == MouseButtons.Left)
{
this.label2.Visible = true;
}//判断是否为左键
}
private void Form1_MouseUp(object sender, MouseEventArgs e)
{
this.label2.Visible = false;
}
————————————————————————————
MouseMove:当鼠标在窗体移动的触发事件,跟e获取x,y的坐标
MouseDown:当按下鼠标的时候,判断是否为左键,如果true,就把label.visible=true;设置显示,
MouseUp:当放开(弹出)鼠标的时候,就直接设置Label为visible=false;o(∩_∩)o...够明白吧。。
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
this.label2.Location = new Point(e.X + 10, e.Y);
this.label2.Text = "当前坐标:"+e.X + "," + e.Y;
}
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
if(e.Button == MouseButtons.Left)
{
this.label2.Visible = true;
}//判断是否为左键
}
private void Form1_MouseUp(object sender, MouseEventArgs e)
{
this.label2.Visible = false;
}
————————————————————————————
MouseMove:当鼠标在窗体移动的触发事件,跟e获取x,y的坐标
MouseDown:当按下鼠标的时候,判断是否为左键,如果true,就把label.visible=true;设置显示,
MouseUp:当放开(弹出)鼠标的时候,就直接设置Label为visible=false;o(∩_∩)o...够明白吧。。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询