I created a button in WinForms and generated an event using VS. Somehow the button disappeared. I checked the designer.cs code and found code specifying the button had changed to locates the button somewhere out of the visible form. I changed the designer code to the following:
// startButton
//
this.startButton.Location = new System.Drawing.Point(118, 758);
this.startButton.Margin = new System.Windows.Forms.Padding(6);
this.startButton.Name = "startButton";
this.startButton.Size = new System.Drawing.Size(140, 46);
this.startButton.TabIndex = 17;
this.startButton.Text = "Start";
this.startButton.UseVisualStyleBackColor = true;
this.startButton.Click += new System.EventHandler(this.StartButton_Click);
Prior to my attempt to change the button position back to where it was supposed to be the System.Drawing.Pont was set at -256, 758. I used another button position in the file to determine that the value should have been 118. However, when I restart the program the button is still missing. Why is this happening and how do I get the button back.
If I can't get the button back what happens if I delete the button code in designer.cs and the event handler. Can I then add a new button to replace the old. Just want to make sure that I don't make an irreversible change that compromises the entire program.
Thanks for any suggestions.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…