English 中文(简体)
防止视觉演播室更新表格中的具体内容。
原标题:Prevent Visual Studio from updating specific lines in Form.Designer.cs

I was wondering is it possible to prevent Visual Studio from updating specific lines that are changed by me? For example i have separate resource only project (images, sounds, etc). I change some lines in Form.Designer.cs and make so all images are loaded from resource dll. But once i update Form it self everything goes back to default and all resources that were used by form gets copied to Form.resx file.
How could i solve this?

最佳回答

最好是把形式设计者从你想要控制的法律中产生。 然后,你需要处理该守则的顺序可以在表格的构造中处理。 例:

namespace FormTest
{
    public partial class Form1 : Form
    {
        private Label PostAddedLabel;

        public Form1()
        {
            InitializeComponent();
            PostInitializeComponents();
        }

        private void PostInitializeComponents()
        {
            if (!this.DesignMode)
            {
                PostAddedLabel = new Label();
                PostAddedLabel.Left = 100;
                PostAddedLabel.Top = 30;
                PostAddedLabel.Text = "The Post-added Label";

                this.Controls.Add(PostAddedLabel);
            }
        }
    }
}

在设计成功设计阶段之后,我们可以简单地设计设计设计设计器内的形式,然后才能把我们想与“后启动”组合方法分开的宣言、任务和相关守则化为行动。

By using the !this.DesignMode decision, the form will show the separated controls in Runtime mode. When in designer-mode these controls will not be shown, assuring that the system will not affect these controls when designing the form.

如果您也想在用户控制中使用这一方法,则试图从以下条款中将“转让者”方法置于“转让”之上:。 带有控制装置的设计

希望能回答问题?

问题回答

Nope。

As stated in the begining of the file, the *.Designer.* is an auto generated file. It s rebuilt every time that the file it depends upon is saved, so you should never change any code there that you don t want to be messed.

视力演播室没有“更新”设计器文档,因此删除了它,并撰写了所有新版本。 做你想要做的事情是不可能的。

你应该把你的法典添加到后面。 同一类别。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签