If you want to modify this design Form Other attributes? The next step is simpler.
Switch Form1 Design Interface, put Splitcontainer, Here again Splitcontainer Right Panel Put Propertygrid, And Dock Set the property value Fill .
SwitchCodeEdit the page and change the last line of the code entered in the previous article:
This . Splitcontainer1.panel1. Controls. Add (View );
Add one line:
This . Propertygrid1.selectedobject = Surface. componentcontainer. components [ 0 ];
Run the project and edit it now.At design timeForm.
In addition to a little drag-and-drop operation, I only wrote six lines of code to implement this function. Is it interesting?
My goal in this topic is to write a usable form designer. What is the purpose? For exampleProgramAfter the release, the user feels that the position of a control needs to be adjusted, and the font color of a control needs to be modified. It does not matter. You can modify the font color on your own. The more complex application is that the user wants to add a field to a document. It doesn't matter. The user or implementer can add the field by themselves. Do not change the code or re-compile the code. Even if users want to add some processing, they can also write code in the designer by the implementer. The system can compile the code and call it at runtime.
Related chapters:
WriteFormDesigner Attempt(I)
Next preview:WriteFormDesigner Attempt(3.)Add controls to the form.