1.选中label2
2.再右下角的属性栏中单击事件选项卡(小闪电)
3.选中MouseEnter,然后双击
4.此时自动出现private void label2_MouseEnter(object sender, EventArgs e)
{}
,在其中添加 comboBox1.Show();
5.完成
同理,鼠标移开事件在第三步选择"MouseLeave"即可
可以用,
// 鼠标进入空间时
private void panel1_MouseEnter(object sender, System.EventArgs e)
{
comboBox1.Visible = true;
}
// 鼠标离开控件时
private void panel1_MouseLeave(object sender, System.EventArgs e)
{
comboBox1.Visible = false;
}
private void label5_MouseEnter(object sender, EventArgs e)
{
comboBox1.Visible = true;
}
private void label5_MouseLeave(object sender, EventArgs e)
{
comboBox1.Visible = false;
}
2楼正解,我也就不多回答了