日期:2014-05-18  浏览次数:21145 次

用C#做如何右下角弹出小窗体
用C#做如何右下角弹出小窗体,我想做的效果是点击一个按钮,右下角出现小窗体..

------解决方案--------------------
参考http://topic.csdn.net/u/20110101/12/90d977da-7244-4e5d-93e7-0196145f3812.html
------解决方案--------------------
C# code

            Form2 frm = new Form2();
            frm.Top =  Screen.PrimaryScreen.Bounds.Bottom - frm.Height;
            frm.Left =  Screen.PrimaryScreen.Bounds.Right - frm.Width;
            frm.Show();

------解决方案--------------------
编写显示窗口事件里
先获取屏幕大小,再设置Location属性,用Form.Show()和Form.Hide()来控制显示和隐藏。 Rectangle rect = System.Windows.Forms.SystemInformation.VirtualScreen;
int width = rect.Width;
int height = rect.Height;
Form1 sy = new Form1();
sy.Location.X = width - sy.Width;
sy.Location.Y = height - sy.Height;
sy.Show();
继续追问: sy.Location.X = width - sy.Width;
sy.Location.Y = height - sy.Height;
这两句有问题吧! Location又不是变量怎么能这样子赋值呢?
补充回答: 那就改为
sy.Location=new System.Drawing.Point(width - sy.Width, height - sy.Height);
继续追问: 还是不行,第二个窗口并没有从右下角想气泡似的往上面弹出来 我是想要当Form1 打开的同时也就是Form1_Load事件发生时Form2就从屏幕的右下角弹出来
补充回答: 那就在要弹出的窗口Load事件里写:
base.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - base.Width, Screen.PrimaryScreen.WorkingArea.Height - base.Height);
继续追问: 0.0 那上面的代码写在那里啊? 再说你说在要弹出的窗口Load事件里面写 , 那到底是写在Form1 里还是在 Form2里面 ... 我是要打开Form1是弹出Form2 ... 还希望你能继续帮我解决完这个问题 太谢谢了
补充回答: 如果你是打算Form2在右下角显示,就在Form1的事件里写
Form2 f2 = new Form2();
f2.Show();
然后在Form2的初始化事件Form2_Load里写
base.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - base.Width, Screen.PrimaryScreen.WorkingArea.Height - base.Height);
继续追问: 嗯 差不多了 但是还有最后一个问题...
Form2 出来的时候好像不是从下往上‘冒’出来的.. 还有就是我想控制一下Form2 ‘冒’的速度要慢一点 再接着 过5秒或者过几秒它自己又要自己会‘冒’下去 也就是说过完几秒钟后 Form2 自己要会自动的关闭.
补充回答: 这里有一个窗体出现的动画效果
http://www.cnblogs.com/light169/articles/1217142.html
再在Form2_Load事件里,加上时间Timer,过了一定时间用
f2.Close()关闭
------解决方案--------------------
http://www.google.com.hk/search?sourceid=chrome&ie=UTF-8&q=C%23%E5%81%9A%E5%A6%82%E4%BD%95%E5%8F%B3%E4%B8%8B%E8%A7%92%E5%BC%B9%E5%87%BA%E5%B0%8F%E7%AA%97%E4%BD%93

http://www.cnblogs.com/wuguilin/archive/2012/01/13/2321277.html