首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

求vs2005 winform 仿QQ窗体特效,该如何解决

2012-05-29 
求vs2005 winform 仿QQ窗体特效求仿QQ窗体,将窗体拖到桌面顶上或边上,窗体就自动隐藏的特效代码。还有窗体

求vs2005 winform 仿QQ窗体特效
求仿QQ窗体,将窗体拖到桌面顶上或边上,窗体就自动隐藏的特效代码。

还有窗体最小化到任务栏右下角图标,双击图标又弹出窗体的特效代码。

谢谢!

[解决办法]
setwindowpos
[解决办法]
第一个功能,鼠标按住界面可以拉动,并获得屏幕分辨率和界面坐标,然后进行隐藏。
这个只是加减代码。
第二个功能,notifyIcon控件+右键控件(右下角图标右键效果)。

C# code
//最小化 → 正常        private void MinimizedToNormal()        {            this.Visible = true;            this.WindowState = FormWindowState.Normal;            显示ToolStripMenuItem.Text = "隐藏窗口";        }        //正常 → 最小化        private void NormalToMinimized()        {            this.WindowState = FormWindowState.Minimized;            this.Visible = false;            显示ToolStripMenuItem.Text = "显示窗口";        }    //界面点击X关闭后 取消关闭 最小化        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)        {            this.NormalToMinimized();            e.Cancel = true;        }//双击右下角图标时 会调用的notifyIcon控件的鼠标双击事件        private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)        {            if (e.Button == MouseButtons.Left)            {                if (this.WindowState == FormWindowState.Minimized)//当窗口是最小化时。                {                    this.MinimizedToNormal();                }                else if (this.WindowState == FormWindowState.Normal)//当窗口是最大化时。                {                    this.NormalToMinimized();                }            }        }
[解决办法]
第一个功能我自己是这样的,不知道有没有更好的办法。同求。
C# code
//窗体 鼠标拉动        [DllImport("user32.dll")]        public static extern bool ReleaseCapture();        [DllImport("user32.dll")]        public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);        public const int WM_SYSCOMMAND = 0x0112;        public const int SC_MOVE = 0xF010;        public const int HTCAPTION = 0x0002;    //界面MouseDown事件        private void Form1_MouseDown(object sender, MouseEventArgs e)        {            ReleaseCapture();            SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);        }    //界面MouseMove事件        private void Form1_MouseMove(object sender, MouseEventArgs e)        {            if (this.Location.X < 0)            {                this.Location = new Point(0, this.Location.Y);            }            if (this.Location.X > System.Windows.Forms.SystemInformation.WorkingArea.Width - this.Size.Width)            {                this.Location = new Point(System.Windows.Forms.SystemInformation.WorkingArea.Width - this.Size.Width, this.Location.Y);            }            if (this.Location.Y > System.Windows.Forms.SystemInformation.WorkingArea.Height - this.Size.Height)            {                this.Location = new Point(this.Location.X, System.Windows.Forms.SystemInformation.WorkingArea.Height - this.Size.Height);            }        }
[解决办法]
NotifyIcon控件解决
[解决办法]
网上很多 窗体抖动的代码!

热点排行