我想要QQ那样的只有一个图标,点击就可以打开还有右击菜单,怎么实现啊,望前辈指点!

解决方案 »

  1.   

    NotifyIcon控件可以實現
    給你一個小列子Private Sub NotifyIcon1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles NotifyIcon1.Click
           If WindowState = FormWindowState.Minimized Then
               WindowState = FormWindowState.Maximized
                Activate()
               NotifyIcon1.Visible = False
                ShowInTaskbar = True
              End If
        End Sub    Private Sub MDIMain_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.SizeChanged
            If WindowState = FormWindowState.Minimized Then
                ShowInTaskbar = False
                NotifyIcon1.Visible = True
            End If
        End Sub
      

  2.   

    private void Form1_SizeChanged(object sender, EventArgs e) 
     { 
      if(this.WindowState==FormWindowState.Minimized) 
      { 
       this.Hide(); 
       this.notifyIcon1.Visible=true; 
      } 
     }  private void notifyIcon1_Click(object sender, EventArgs e) 
     { 
      this.Visible = true; 
      this.WindowState = FormWindowState.Normal; 
      this.notifyIcon1.Visible = false; 
     } 
      

  3.   

    NotifyIcon一个控件,指定一个ico图标就可以了
      

  4.   

    1.设置WinForm窗体属性showinTask=false2.加notifyicon控件notifyIcon1,为控件notifyIcon1的属性Icon添加一个icon图标。3.添加窗体最小化事件(首先需要添加事件引用):this.SizeChanged += new System.EventHandler(this.Form1_SizeChanged);//上面一行是主窗体InitializeComponent()方法中需要添加的引用private void Form1_SizeChanged(object sender, EventArgs e)
    {
    if (this.WindowState==FormWindowState.Minimized)
    {
    this.Hide();
    this.notifyIcon1.Visible=true;
    }}
    4.添加点击图标事件(首先需要添加事件引用):