Prevent Form.resx Creation

I have a form inheriting from another. In the designer, when I set up something like the size or location of the control, VS automatically creates a resx file for this form. Resx just contains some KeyValuePairs for comboboxes, w / c are not needed since these values ​​are already defined in the parent class.

In addition, the .cs constructor also receives an update with inherited properties such as Text, NumericUpDown.Value, DisplayMember, ValueMember, etc., w / c are already defined in the parent class again.

I know that designer.cs needs to be updated with a new location and size, but I do not want it to update other materials inherited from the parent class.

Is there a way to prevent this, and just let the designer update the location and size?

UPDATE: I found that ComboBox.Items.AddRange () is being added to the Designer.cs and .resx files due to the binding logic that I have in OnLoad (). This primarily prevents the designer from loading correctly when the form reloads in the designer.

I modified OnLoad to start binding logic only when DesignMode is false.

The form no longer throws errors when reloading the constructor, but some control properties are still unreasonably added back to Designer.cs whenever I change any property through the properties dialog.

UPDATE2: Completely prevented the designer from creating unnecessary control properties by applying the sentence here .

Now all that is generated is the location and size of the control.

+3

Source: https://habr.com/ru/post/1741987/


All Articles