如何将用户控件表单添加到Windows窗体并以Windows窗体形式运行输出? [英] how to add usercontrol form to windows form and run the output in windows form?

查看:85
本文介绍了如何将用户控件表单添加到Windows窗体并以Windows窗体形式运行输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨小伙子们,我在WINDOWS FORM CONTROL库中创建了一个用户控件表单,设计和编码......执行我想要的......

但是我想在windows中输出form ...所以我打开一个窗体并将这个用户控件拖放到窗体中,...我有一个休息时...没有当我想执行时,输出进入用户控件测试容器 ....



我应该编写什么代码来执行windowsform中的用户控件....?

hi guys,,, i created a user control form in WINDOWS FORM CONTROL library, designed and coded... executing exactly how i want....
but i want the output in windows form... so i opened a windows form and drag and dropped this usercontrol into the form,... there i got a break... no when i want to execute, the output is coming in user control test container....

what code should i have to write to execute the user control in windowsform....?

推荐答案

这不是我们可以回答的问题:它通常是UserControl的默认构造函数的问题。



所以删除您在表单上放置的实例,并在单击按钮时以编程方式添加实例:

That isn't a question we can answer: it's usually a problem with the default constructor of your UserControl.

So remove the instance you dropped on the form, and add an instance programmatically, on a button click:
private void butTestUserControl_Click(object sender, EventArgs e)
    {
    MyUserControl uc = new MyUserControl();
    Controls.Add(uc);
    }

然后在第一行放置一个断点并进入构造函数:按照代码查找问题所在。



很抱歉,但我们不能为您做到这一点!

Then put a breakpoint on the first line and step into the constructor: follow the code through and look for where the problem is.

Sorry, but we can't do that for you!


这篇关于如何将用户控件表单添加到Windows窗体并以Windows窗体形式运行输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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