我在InitializeComponent中调用了一个覆盖方法。
public class ComponentResourceManager2 : System.ComponentModel.ComponentResourceManager我的问题是,每次我在DesignerForm中更改某些内容时,方法InitializeComponent都会更改,以便该方法使用system。
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager();我需要这个
private void InitializeComponent()
{
ComponentResourceManager2 resources = new ComponentResourceManager2(typeof(Form1));
this.directDrawViewer1 = new MyOwn.Imaging.Components.DirectDrawViewer();
this.speedButton1 = new MyOwn.Components.SpeedButton();
...但是每当我改变一些东西,它就会再次发生这样的事情:
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.directDrawViewer1 = new MyOwn.Imaging.Components.DirectDrawViewer();
this.speedButton1 = new MyOwn.Components.SpeedButton();如何使我的方法成为InitializeComponent使用的方法,而不每次发生更改时都被重置?
发布于 2017-10-25 16:23:47
您不应该更改设计器代码,在调用InitializeComponent()之后,在表单的构造函数中设置在InitializeComponent中设置的内容。Visual将在每次更改设计器中的某些内容时重新生成设计器文件。
https://stackoverflow.com/questions/46937326
复制相似问题