The primary role of the Splitter control is to partition the window and adjust the area size, for example: I want to divide the window into about two regions and adjust the proportions of two regions. The operation process is as follows:
1, a new window: Form1;
2. Add a Panel control Panel1 to the Form1 and set its Dock property to the Left,backcolor property set to blue;
3. Add a splitter control Splitter1 to the Form1 and set its Dock property to left;
4. Add a Panel control Panel2 in Form1 and set its Dock property to black Fill,backcolor property;
Second, WinForm programming often need to apply button control, sometimes we want to change the button shape, in fact, simply change the button shape is very simple, the following I want to talk about this method can be simply understood as, In a rectangular area, add a closed area surrounded by several segments, displaying only the enclosed area without displaying the area outside the enclosing area. To achieve this, we use a property region (enclosing area) of the button control, an event paint (drawing the shape).
Then, in the example above, we add a button button1 to the panel and set its Anchor property to Bottom,right. The Paint event is found in the Button1 event, which is called when the shape of the button1 is drawn when the program is run, so we simply add code to change the region property to change the shape of the button1. Add the code as follows:
Using System.Drawing.Drawing2D;
private void Button1_paint (object sender, PaintEventArgs e)
{
GraphicsPath path = new GraphicsPath ();
Path. AddLines (new point[] {new Point (2), new Point (+), new Point (X), new Point (X), new Point (M), new P Oint (+), new Point (2), new Point (X),});
This.button1.Region = new Region (path);
}
This code is very well understood: first is to set a GraphicsPath type of path, and then add a few segments in this path (the origin of the coordinate system is the upper-left corner of the button1), the size of the button we set is 70, 36, in the coordinate system of the button1 in the lower right corner of the coordinates is (70,36), and then we are in this rectangular area to find 7 points around an arrow shape can be, and finally the Button1 region property to be assigned a value.
The effect is as shown in the following illustration: