在运行时复制控制按钮,无需再次编写代码 [英] Copy control button in run time without write his code again

查看:99
本文介绍了在运行时复制控制按钮,无需再次编写代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好我用一些表单创建应用程序我有一个这样的形式的按钮我希望在第二种形式的运行时复制控制此按钮而不再创建它。例如,我在运行时在表单1中有X按钮我希望在表单2中创建此按钮的副本,其中包含表单1中的所有属性。这是一个按钮的示例我有

为了避免再次写下他的代码请帮忙吗?



Hi all I create application with some forms i have button in one form of this i want in run time copy control of this button in the second form without create it again. For example , i have X button in form 1 in run time i want to create a copy of this button in form 2 with all properties it's have in form 1. This an example for one button i have
To avoid write his code again help please?

<Button Content="Open Window" Click="ButtonClicked" Height="25"
HorizontalAlignment="Left" Margin="379,264,0,0" Name="button1" 
VerticalAlignment="Top" Width="100" />

推荐答案

创建此表单的多个实例。

例如

Create multiple instaces of this form.
For e.g.
Form1 frm1 = new Form1();
Form1 frm2 = new Form1();


这篇关于在运行时复制控制按钮,无需再次编写代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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