在C#中显示新窗口 [英] Show new Window in c#

查看:163
本文介绍了在C#中显示新窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用代码动态创建表单,并向其添加用户控件,而不是显示表单
如果我将背景图像添加到带有拉伸到backgroundimagelayout的用户控件中,则在完全加载后,如果我不放置任何内容,窗体将闪烁,它不会执行任何操作并正确加载.


有谁知道如何解决它,我想使图像大小与屏幕大小相同,但这不是一个好方法.

i create a form dynamically in code and add a user control to it than i show the form
if i add a background image to the user control with stretch to the backgroundimagelayout the form will flashes after complete loading if i put none it does nothing and load correctly.


does anyone know how to solve it, i am looking to make the image size same as the screen size but it is not good way.

Form f = new Form();
f.Size = SystemInformation.VirtualScreen.Size;
uc.Dock = DockStyle.Fill;
f.Controls.Add(uc);
f.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
f.TopMost = true;
f.Show();




感谢您的帮助.




thanks for anyhelp

推荐答案

好吧,我在使用c#创建,交流和打开新表单时遇到了问题.
我建议您先设计表单,然后在代码上创建它,并修改其属性以用于自定义用途.对于闪烁的问题(假设它闪烁并关闭),我将其净化,并使用form.ShowDialog()防止在用户决定之前将其丢弃.
Well I had problems creating, communicating and opening new forms in c#.
I would recommend you design the form first, then create it on code and modificate its properties for a customize use. For the flashing problem (supposing it flashes and closes) I would depurate it and use form.ShowDialog() preventing it gets disposed before user decides it.


这篇关于在C#中显示新窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆