Solve all the controls on the C# interface suddenly disappear, but there are still methods defined by these controls in ".Disigner".

     I have encountered this problem myself once, and I was stunned at that time, because I just laid out the interface and didn't have time to back it up. Open the ".Designer" corresponding to this window, and find that the definitions of the controls are still there, even more confused, I don't know why. Then I checked the information on the Internet, and the reason given was "The C# designer is not safe, and this phenomenon occurs occasionally." Well, it seems that I am very lucky, hahaha~

     Some people say that when this happens, don't recompile, close the current project, and reopen it. However, I have recompiled it, o(︶︿︶)o alas.

     Some people say that in ".Disigner", check whether the .add statement added by each control to the window still exists. If it does not exist, you can only add it manually. As soon as I checked, it was indeed gone, senior mighty. The statement is as follows:

this.Controls.Add(this.lable1);

    The above sentence is to display a defined lable control in the current window. Before this sentence, the control exists, but it will not be displayed on the window. How many individual controls need to be displayed on the window, you need several statements like the above. Note that it is a separate control. If you have 3 button controls, but they are all added to the Panel, then you only need a statement to add the current Panel to the window.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324897052&siteId=291194637