C# WINFORM 类似QQ窗体自动隐藏后,当最小化,或按"桌面"按钮后,不能在隐藏处再次显示窗体,或在任务栏中点击对话来找回窗体,只能通过"最大化"后"还原"才能找回窗体,

解决方案 »

  1.   

    http://download.csdn.net/source/1816238
    这里有个隐藏的下载!我搜的!但是我没有用过!
      

  2.   

    用visual = false就行啊。那个不会动位置的啊
      

  3.   

    http://blog.csdn.net/lovelan1748/archive/2009/12/28/5088349.aspx
    前段时间写的隐藏类,靠左考上靠右的隐藏,都没问题
      

  4.   

    http://download.csdn.net/source/1951864
    这里有含源码的例子,也没多少代码
      

  5.   

            private void Form1_SizeChanged(object sender, EventArgs e)
            {
                if (this.WindowState == FormWindowState.Minimized)//最小化时才执行
                {
                    this.Visible = false;//隐藏窗体
                    this.notifyIcon1.Visible = true;//显示托盘图标
                    this.notifyIcon1.Text = this.Text;//设置托盘文本
                } 
            }
            private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
            {
                if (this.ShowInTaskbar == false)
                notifyIcon1.Visible = true;//icon显示
                this.ShowInTaskbar = true;//窗体图标
                this.Show();
                this.Activate();
                this.WindowState = FormWindowState.Normal;//恢复
            }
      

  6.   

    我汗了,难道你们指的隐藏是Visible = false???哪家QQ是这样做的?
      

  7.   

    在任务栏点击估计会出发onfocus事件吧,在那里面自己手动处理显示隐藏逻辑吧。
      

  8.   

            [System.Runtime.InteropServices.DllImport("coredll")]
            public static extern bool ShowWindow(IntPtr hwnd, int nCmdShow);
            public const int SW_MINIMIZE = 6;拿去用。
      

  9.   

    问题算是解决了吧,但不算完美,我的解决办法是:先屏蔽了"最小化"按钮,然后是:TopMost=true;这样做是为了一,不让客户最小化窗体,那么就不会出现找不到窗体的问题,当然允许他们隐藏;二,让窗体总是显示在最前端,那么按"桌面"按钮,就不会把窗体隐去.总体上算是接受吧,但就是不那么好,有点别扭;不是不想让客户最小化,而是最小化后,窗体隐藏在左下角"开始"那里,而且还是靠边隐藏那种,要是不留意,还是会找不到窗体,可能是"隐藏"代码段那里有点小缺陷,但现在又找不到解决办法,希望大侠们教教我...我把控制"隐藏"的代码贴出来,大家看看:         private void ConsoleForm_Load(object sender, EventArgs e)
            {
                System.Windows.Forms.Timer StopRectTimer = new System.Windows.Forms.Timer();
                StopRectTimer.Tick += new EventHandler(timer1_Tick);
                StopRectTimer.Interval = 100;
                StopRectTimer.Enabled = true;
             }
    private void timer1_Tick(object sender, EventArgs e)
            {
                if (this.Bounds.Contains(Cursor.Position))
                {
                    switch (this.StopAanhor)
                    {
                        case AnchorStyles.Top:
                            this.Location = new Point(this.Location.X, 0);
                            break;
                        case AnchorStyles.Left:
                            this.Location = new Point(0, this.Location.Y);
                            break;
                        case AnchorStyles.Right:
                            this.Location = new Point(Screen.PrimaryScreen.Bounds.Width - this.Width, this.Location.Y);
                            break;
                    }
                }
                else
                {
                    switch (this.StopAanhor)
                    {
                        case AnchorStyles.Top:
                            this.Location = new Point(this.Location.X, (this.Height - 3) * (-1));
                            break;
                        case AnchorStyles.Left:
                            this.Location = new Point((-1) * (this.Width - 3), this.Location.Y);
                            break;
                        case AnchorStyles.Right:
                            this.Location = new Point(Screen.PrimaryScreen.Bounds.Width - 3, this.Location.Y);
                            break;
                    }
                }
            }
            internal AnchorStyles StopAanhor = AnchorStyles.None;
            private void mStopAnhor()
            {
                if (this.Top <= 0)
                {
                    StopAanhor = AnchorStyles.Top;
                }
                else if (this.Left <= 0)
                {
                    StopAanhor = AnchorStyles.Left;
                }
                else if (this.Left >= Screen.PrimaryScreen.Bounds.Width - this.Width)
                {
                    StopAanhor = AnchorStyles.Right;
                }
                else
                {
                    StopAanhor = AnchorStyles.None;
                }
            }
      private void ConsoleForm_LocationChanged(object sender, EventArgs e)
            {
                this.mStopAnhor();
            }
      

  10.   

    你是不是想做QQ那种  一点最小化下面不会显示 然后跟QQ一样缩小成一个QQ图标在右下角 然后双击 它又
    显示出来了。如果是这样的话 说声。很好实现。我给你一个我写过的类似源码