想做一个类似QQ的弹出提示框 就是鼠标移动到好友头像上时弹出来的那个框,不知道那位仁兄做过或是有什么思路,望讲解!谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 楼上的是说那个提示框做成一个对话框,然后永MouseMove来判断是否显示? public partial class Form5 : Form { public Form5() { //InitializeComponent(); this.SuspendLayout(); // // Form5 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(144, 398); this.Name = "Form5"; this.Text = "Form5"; this.Load += new System.EventHandler(this.Form5_Load); this.ResumeLayout(false); } Form6 f6 = new Form6(); private void Form5_Load(object sender, EventArgs e) { f6.Show(); f6.Hide(); for (int i = 0; i < 5; i++) { Button but = new Button(); but.Location = new Point(50, i * 100); but.Size = new Size(50, 50); but.Text = "文本" + i; but.MouseHover += new EventHandler(but_MouseHover); but.MouseLeave += new EventHandler(but_MouseLeave); this.Controls.Add(but); } } void but_MouseLeave(object sender, EventArgs e) { f6.Hide(); } void but_MouseHover(object sender, EventArgs e) { Button bu = sender as Button; int x = this.Location.X + bu.Location.X - f6.Width; int y = this.Location.Y + bu.Location.Y + f6.Height - bu.Height - 25; f6.Location = new Point(x, y); f6.Lable1 = bu.Text; f6.Show(); }public partial class Form6 : Form { Label label1 = new Label(); public Form6() { InitializeComponent(); label1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; label1.Dock = System.Windows.Forms.DockStyle.Fill; this.Controls.Add(label1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; } public string Lable1 { set { label1.Text = value; } } } void but_MouseHover(object sender, EventArgs e) { Button bu = sender as Button; int x = this.Location.X + bu.Location.X - f6.Width; int y = this.Location.Y + bu.Location.Y + f6.Height - bu.Height - 25; f6.Location = new Point(x, y); f6.Lable1 = bu.Text; f6.Show(); this.Activate();//少了这句会使当前窗体失去焦点补上去 } 不好意思这样Form6会出现在任务栏中在Form6的构造中加上this.ShowInTaskbar = false; 关于.net 4.0下并行计算的问题 基于Easysl 架构的Silverlight应用程序部署在IIS7.0上之后出现错误 为什么CheckBox的触发事件只成功一次? 求救 splitterpanel 未将对象引用设置到对象的实例 关于乱码的问题 C#两个DataTable之间数据进行比较 winform窗体通信问题 VS2008 如何调用.net 4.0的dll? 能否设置ComboBox选中的项加粗,没选中的项不变? Winform Dev GridControl控件将选中行上移,下移,置前,置后怎么做 多线程获取控件的值 调试的问题
public partial class Form5 : Form
{
public Form5()
{
//InitializeComponent();
this.SuspendLayout();
//
// Form5
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(144, 398);
this.Name = "Form5";
this.Text = "Form5";
this.Load += new System.EventHandler(this.Form5_Load);
this.ResumeLayout(false);
}
Form6 f6 = new Form6();
private void Form5_Load(object sender, EventArgs e)
{
f6.Show();
f6.Hide();
for (int i = 0; i < 5; i++)
{
Button but = new Button();
but.Location = new Point(50, i * 100);
but.Size = new Size(50, 50);
but.Text = "文本" + i;
but.MouseHover += new EventHandler(but_MouseHover);
but.MouseLeave += new EventHandler(but_MouseLeave);
this.Controls.Add(but);
}
} void but_MouseLeave(object sender, EventArgs e)
{
f6.Hide();
} void but_MouseHover(object sender, EventArgs e)
{
Button bu = sender as Button;
int x = this.Location.X + bu.Location.X - f6.Width;
int y = this.Location.Y + bu.Location.Y + f6.Height - bu.Height - 25;
f6.Location = new Point(x, y);
f6.Lable1 = bu.Text;
f6.Show();
}public partial class Form6 : Form
{
Label label1 = new Label();
public Form6()
{
InitializeComponent(); label1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
label1.Dock = System.Windows.Forms.DockStyle.Fill;
this.Controls.Add(label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
} public string Lable1
{
set { label1.Text = value; }
}
}
void but_MouseHover(object sender, EventArgs e)
{
Button bu = sender as Button;
int x = this.Location.X + bu.Location.X - f6.Width;
int y = this.Location.Y + bu.Location.Y + f6.Height - bu.Height - 25;
f6.Location = new Point(x, y);
f6.Lable1 = bu.Text;
f6.Show();
this.Activate();//少了这句会使当前窗体失去焦点补上去
}