I created a copy of Form1.cs and called the new Form2 and each time the program is assembled, Form2 becomes the same as Form1 and I just need to copy Form1 into Form2 and change Form2

and also I cannot change Form2 in any way and these squares still ...

http://imgur.com/a/k2ro1


I add a new form select the derivative form
After I choose Form1
and creates a copy of Form2 on the screen I have already created

enter image description here

enter image description here

I need to change this copy for myself.
but she doesn't let herself change
how can i make a copy that i could change

  • What does Form2 mean the same as Form1? Does the designer become the same, or during program execution? - Zergatul
  • And why you did not attach pictures here? Describe more specifically what is wrong, the essence of your question is not clear. - Denis Bubnov

1 answer 1

"Derived form" is a form inherited from the one selected in the wizard.

Please note that the header of the Form2 class looks like this:

 public partial class Form2 : DatingSimulator.Form1 

Here is the addition after : in the class name and says that the form is inherited from Form1 . Unlike forms created in the usual way, which are inherited from the library class Form , the title of which looks like this:

 public partial class Form1 : Form 

Inheritance in OOP in general and C # in particular is strictly expanding, which means that you cannot delete anything inherited from an ancestor.

The "derived form" is used when you have an implementation of some basic form that contains only elements and code common to all forms. Then you can create derived forms in order not to duplicate this code, but to add only the elements and code that you need in a particular form.

In your case, option two.

  1. abandon the use of derived forms and write each form separately and independently. Well, or save-paste.

  2. create a minimal basic form that will contain only elements common to all other forms, and, in particular, will already be implemented in derivatives.

The choice of options for you, but the second is preferable.


A small note, for your goal it is more convenient to create not separate forms for each game screen, but to create separate controls for this, which will be displayed in a specific order. Look towards using UserControl as the basis for game screens.