c#单击窗体按钮消失代码怎么写?
我用的是VisualC#2005,请问我要实现单击窗体时按钮消失双击窗体时按钮重新显示,并且按钮一直跟着鼠标走,我要怎么来写代码啊?急需,谢谢!...
我用的是VisualC#2005,请问我要实现单击窗体时按钮消失双击窗体时按钮重新显示,并且按钮一直跟着鼠标走,我要怎么来写代码啊?急需,谢谢!
展开
2个回答
展开全部
public
partial
class
Form1
:
Form
{
int
offset
=
5;
public
Form1()
{
InitializeComponent();
}
private
void
Form1_Click(object
sender,
EventArgs
e)
{
button1.Visible
=
false;
}
private
void
Form1_DoubleClick(object
sender,
EventArgs
e)
{
button1.Visible
=
true;
}
private
void
Form1_MouseMove(object
sender,
MouseEventArgs
e)
{
if
(button1.Visible)
button1.Location
=
new
Point(e.X
+
offset,
e.Y
+
offset);
}
}
partial
class
Form1
:
Form
{
int
offset
=
5;
public
Form1()
{
InitializeComponent();
}
private
void
Form1_Click(object
sender,
EventArgs
e)
{
button1.Visible
=
false;
}
private
void
Form1_DoubleClick(object
sender,
EventArgs
e)
{
button1.Visible
=
true;
}
private
void
Form1_MouseMove(object
sender,
MouseEventArgs
e)
{
if
(button1.Visible)
button1.Location
=
new
Point(e.X
+
offset,
e.Y
+
offset);
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
public partial class Form1 : Form
{
int offset = 5;
public Form1()
{
InitializeComponent();
}
private void Form1_Click(object sender, EventArgs e)
{
button1.Visible = false;
}
private void Form1_DoubleClick(object sender, EventArgs e)
{
button1.Visible = true;
}
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if (button1.Visible)
button1.Location = new Point(e.X + offset, e.Y + offset);
}
}
{
int offset = 5;
public Form1()
{
InitializeComponent();
}
private void Form1_Click(object sender, EventArgs e)
{
button1.Visible = false;
}
private void Form1_DoubleClick(object sender, EventArgs e)
{
button1.Visible = true;
}
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if (button1.Visible)
button1.Location = new Point(e.X + offset, e.Y + offset);
}
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |