想做一个类似QQ的弹出提示框

htz92127 2008-09-30 02:56:05
就是鼠标移动到好友头像上时弹出来的那个框,不知道那位仁兄做过或是有什么思路,望讲解!谢谢!
...全文
210 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
htz92127 2008-09-30
  • 打赏
  • 举报
回复
大概了解了!
NowtAngell 2008-09-30
  • 打赏
  • 举报
回复
4楼思路正解.
AbnerChou 2008-09-30
  • 打赏
  • 举报
回复
帮顶下。
rockyvan 2008-09-30
  • 打赏
  • 举报
回复
看看
jishengzu 2008-09-30
  • 打赏
  • 举报
回复
不好意思这样Form6会出现在任务栏中在Form6的构造中加上this.ShowInTaskbar = false;
jishengzu 2008-09-30
  • 打赏
  • 举报
回复

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();//少了这句会使当前窗体失去焦点补上去
}
jishengzu 2008-09-30
  • 打赏
  • 举报
回复

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; }
}
}
htz92127 2008-09-30
  • 打赏
  • 举报
回复
楼上的是说那个提示框做成一个对话框,然后永MouseMove来判断是否显示?
clming327 2008-09-30
  • 打赏
  • 举报
回复
根据指针事件来判断并显示窗口。
htz92127 2008-09-30
  • 打赏
  • 举报
回复
谢谢帮顶
Zeteyu 2008-09-30
  • 打赏
  • 举报
回复
这种效果在网页中容易做,就一个隐藏DIV,点头像显示
WINFORM就不会了
帮顶

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧