0

In my project a have an toolStrip element which behaves strange after modification in Resources.resx file. Doesn't matter what I do: add a new bitmap, delete old bitmap, change Display style of dropdown buttons... Every time I got error messages and no toolStrip at the form.

In my Form.Designer.cs happens next:

Before modification code looks like:

        // 
        // toolStrip1
        //             
        this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
        this.toolStripDropDownButton1,
        this.toolStripSeparator4,
        this.toolStripDropDownButton2});
        this.toolStrip1.Location = new System.Drawing.Point(0, 0);
        this.toolStrip1.Name = "toolStrip1";
        this.toolStrip1.Size = new System.Drawing.Size(1584, 27);
        this.toolStrip1.TabIndex = 347;
        this.toolStrip1.Text = "toolStrip1";

After:

    // 
    // toolStrip1
    //      
    this.toolStrip1.Location = new System.Drawing.Point(0, 0);
    this.toolStrip1.Name = "toolStrip1";
    this.toolStrip1.Size = new System.Drawing.Size(1584, 27);
    this.toolStrip1.TabIndex = 347;
    this.toolStrip1.Text = "toolStrip1";

My DropDownButton before modification:

        // 
        // toolStripDropDownButton1
        // 
        this.toolStripDropDownButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.ImageAndText;
        this.toolStripDropDownButton1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
        this.openFileToolStripMenuItem,
        this.saveCalculationsFileToolStripMenuItem,
        this.saveRawCalculationsFileToolStripMenuItem});
        this.toolStripDropDownButton1.Image = global::Project_Tribo_v._0._2.Properties.Resources.folder_document;
        this.toolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
        this.toolStripDropDownButton1.Name = "toolStripDropDownButton1";
        this.toolStripDropDownButton1.Size = new System.Drawing.Size(61, 24);
        this.toolStripDropDownButton1.Text = "File";

And after:

            // 
            // toolStripDropDownButton1
            //                 
            this.toolStripDropDownButton1.Image = global::Project_Tribo_v._0._2.Properties.Resources.folder_document;
            this.toolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.toolStripDropDownButton1.Name = "toolStripDropDownButton1";
            this.toolStripDropDownButton1.Size = new System.Drawing.Size(61, 24);
            this.toolStripDropDownButton1.Text = "File";

It's not a big problem, while I have small number of toolStrip elements, but stil...

Any ideas how to avoid or repair this?

MCv
  • 118
  • 1
  • 10
  • Are you modifying...what? Designer generated resx/cs? If it's the case then just don't do it... – Adriano Repetti Apr 02 '15 at 11:40
  • Any modifications leads to the problem. Even if I just change the text in textbox by properties field. – MCv Apr 02 '15 at 11:44
  • I mean: are you manually chaning designer generated resx/cs files? If this is what you're doing then: DO NOT DO IT. If it happens when modifying form from within designer then it's another issue (but I can't imagine what). – Adriano Repetti Apr 02 '15 at 11:47
  • 1
    The designer isn't that resilient to doing this. Non-zero odds that you'll cause an exception at design time because a control is using a resource that is not longer available. And yes, you'll lose parts of your design when that happens. – Hans Passant Apr 02 '15 at 14:16

0 Answers0