Loading...
Loading...
Compare original and translation side by side
using Syncfusion.Windows.Forms.Tools;
// Create GridLayout instance
GridLayout gridLayout1 = new GridLayout();
gridLayout1.ContainerControl = this;
// Configure grid structure
gridLayout1.Rows = 2;
gridLayout1.Columns = 2;
// Set spacing
gridLayout1.HGap = 10;
gridLayout1.VGap = 10;
// Add child controls
ButtonAdv button1 = new ButtonAdv() { Text = "Button 1" };
ButtonAdv button2 = new ButtonAdv() { Text = "Button 2" };
this.Controls.Add(button1);
this.Controls.Add(button2);
// Include controls in layout
gridLayout1.SetParticipateInLayout(button1, true);
gridLayout1.SetParticipateInLayout(button2, true);using Syncfusion.Windows.Forms.Tools;
// Create GridLayout instance
GridLayout gridLayout1 = new GridLayout();
gridLayout1.ContainerControl = this;
// Configure grid structure
gridLayout1.Rows = 2;
gridLayout1.Columns = 2;
// Set spacing
gridLayout1.HGap = 10;
gridLayout1.VGap = 10;
// Add child controls
ButtonAdv button1 = new ButtonAdv() { Text = "Button 1" };
ButtonAdv button2 = new ButtonAdv() { Text = "Button 2" };
this.Controls.Add(button1);
this.Controls.Add(button2);
// Include controls in layout
gridLayout1.SetParticipateInLayout(button1, true);
gridLayout1.SetParticipateInLayout(button2, true);| Property | Type | Purpose |
|---|---|---|
| Rows | int | Specifies number of rows in the grid (dictates columns if set) |
| Columns | int | Specifies number of columns (used when Rows is null or negative) |
| HGap | int | Horizontal spacing between controls and layout border |
| VGap | int | Vertical spacing between controls and layout border |
| ContainerControl | Control | The form or container that holds the layout manager |
| 属性 | 类型 | 用途 |
|---|---|---|
| Rows | int | 指定网格的行数(如果设置了该值,列数会由其决定) |
| Columns | int | 指定列数(当Rows为null或负数时生效) |
| HGap | int | 控件之间以及控件与布局边框之间的水平间距 |
| VGap | int | 控件之间以及控件与布局边框之间的垂直间距 |
| ContainerControl | Control | 承载布局管理器的窗体或容器 |
gridLayout1.Rows = null; // Let rows auto-calculate
gridLayout1.Columns = 1;gridLayout1.Rows = null; // Let rows auto-calculate
gridLayout1.Columns = 1;gridLayout1.Rows = 3;
gridLayout1.Columns = 3;
gridLayout1.HGap = 5;
gridLayout1.VGap = 5;gridLayout1.Rows = 3;
gridLayout1.Columns = 3;
gridLayout1.HGap = 5;
gridLayout1.VGap = 5;// Hide a control from layout without removing it
gridLayout1.SetParticipateInLayout(controlToHide, false);// Hide a control from layout without removing it
gridLayout1.SetParticipateInLayout(controlToHide, false);