C-Sharp Windows应用程序中表单设计/代码的副本 [英] Copy of Form design/codeing in C-Sharp Windows Application

查看:69
本文介绍了C-Sharp Windows应用程序中表单设计/代码的副本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以在C Sharp Windows应用程序中复制包含所有设计/编码以及另一个表单名称的表单吗?

这样可以节省设计/复制时的时间

如果可以,如何

请帮助我

Can We copy a Form with all Design/Coding with another Form Name in C Sharp Windows Application.

So that we may save time at design/copy time

If, Yes HOW

Please Help me

推荐答案

请按照"Praveen Kullu"所述复制源,但我建议您制作用户控件"并以多种形式使用,这是一种简便且更好的方法.
编写自定义用户控件 [
Wel you can copy the from as mentioned by "Praveen Kullu" but i will suggest you to make "User Control" and use it on multiple forms, it is easy and better approach.
Writing your Custom User Control[^]


是的,您可以使用代码复制所有From design.上面Praveen解释的方法
但是请不要忘记更改名称空间和类名.
Yes, you can copy all From design with code. Method explain above by Praveen
But don''t forget to change namesapce and classname.


是的,您可以..

首先复制表单设计:说Form1.cs[Design]
到另一种形式.说Form2.cs[Design]

然后将所有的form1代码复制到form2代码;
Form1.csForm2.cs

然后执行以下操作:

在表格2的代码中,将其更改为
Yes you can..

Copy the form design first: say Form1.cs[Design]
to another form. say Form2.cs[Design]

then copy all the form1 code to form2 code;
i.e Form1.cs to Form2.cs

Do these things after that:

In the code for form 2, change this to
public partial class Form1 : Form
    {
      public Form1()
        {





public partial class Form2 : Form
    {
      public Form2()
        {



如果Form2中的控件必须与Form1中的控件相同,那么您无需更改其他任何内容.

寻找任何可能会丢失的控件.只需将它们从资源中删除即可.



If the controls in form2 have to be same as in form1, then you don''t need to change anything else.

Look for any controls that could get missing. Just remove them from resources.


这篇关于C-Sharp Windows应用程序中表单设计/代码的副本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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