Popup window in C#.net

六眼飞鱼酱① 提交于 2019-12-20 04:16:22

问题


How to popup a child form when I click the button. I want to child winform to be in the centre of the screen and the whole background screen should be blurred. and a small close button should be visible in the right corner of the form. I have searched the web but found nothing.

Using Winforms.


回答1:


Make a new windows form. it has a close button by default. Set it default position to center screen. Then on your button click.

Lets say your new form is Form2

Form2 frm = new Form2();
frm.ShowDialog();

it will not make the rest of screen blurred but user will not be able to do anything with it.

For blurry effect a workaround has been posted here




回答2:


You can trigger event from click button like this

Form form1=new Form();
form1.show;

and after that to blurr the parent screen use opacity property of and increase or decrease it accord to your requirement. you can also control the transparency of the child form using a timer and increase paacity with timer click it will make it more dynamic and interactive.



来源:https://stackoverflow.com/questions/18269616/popup-window-in-c-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!