开发者

Prevent from generating Form.resx

I have a form that inherits from another from. In the designer, whenever I adjust something like control size or location, VS auto-generates a resx file for that form. The resx just contains some KeyValuePairs for comboboxes, w/c are unnecessary really since these values are already defined in the parent class.

Aside from this, the designer.cs also gets update w/ inherited properties such as Text, NumericUpDown.Value, DisplayMember, ValueMember, etc, w/c again are already defined in the parent class.

I know the designer.cs is supposed to be update w/ the new location and size, but I don't want it to update other stuff that's inherited from parent class.

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

UPDATE: I found that the ComboBox.Items.AddRange() gets added to the Designer.cs and .resx f开发者_C百科ile due to binding logic that I have in OnLoad(). This is primarily preventing the designer to load properly when the form is reloaded on the Designer.

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

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

UPDATE2: Totally prevented the designer from generating unnecessary control properties by applying suggestion here.

Now all that's generated are control location and size.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜