如何使用最新的控件创建表单实例 [英] how to create the instance of the form with latest controls in it

查看:67
本文介绍了如何使用最新的控件创建表单实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个form1和一个按钮控件和一个面板。在每个按钮单击事件中,面板中的控件都会更改。当我创建表单的实例时,它创建了第一次加载的表单实例。如何使用其中的最新控件创建表单实例。提前感谢

解决方案

如果要在运行时添加控件,则无法在其中创建具有最新控件的实例:表单已在设计中修复时间并编译到你的EXE文件中。



要做你想做的事,你需要创建一个基本表单,并重新添加新控件到它。 - 基本上重复你所做的将现有表单转换为该状态。



你究竟如何做到这一点取决于你的代码如何工作 - 我看不到!

i have a form1 and a button control and a panel. In each button click event the controls in the panel changes. and when i create the instance of the form it create the instance of the form which was load in the very first time. How to create the instance of the form with the latest controls in it. thanks in advance

解决方案

You can't "create an instance with the latest controls in it" if you are adding controls at run time: the form is fixed at design time and compiled into your EXE file.

To do what you want, you need to create a "basic" form, and re-add the "new" controls to it. - basically repeating what you did to get the existing form to that state.

Exactly how you do that depends on how your code works - and I can't see that!


这篇关于如何使用最新的控件创建表单实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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