添加StackPanel示例

This commit is contained in:
czz_y 2024-08-17 15:38:40 +08:00
parent ffe027449b
commit 467c60ecd4
20 changed files with 1424 additions and 917 deletions

View File

@ -67,6 +67,9 @@ namespace AntdUIDemo
case "Panel":
control = new PanelDemo();
break;
case "StackPanel":
control = new StackPanelDemo(this);
break;
}
if (control != null)
{

View File

@ -24,4 +24,6 @@
### GridPanel
![GridPanel](assets/screenshots/GridPanel.png)
### Panel
![Panel](assets/screenshots/Panel.png)
![Panel](assets/screenshots/Panel.png)
### StackPanel
![StackPanel](assets/screenshots/StackPanel.png)

View File

@ -118,7 +118,7 @@
this.stackPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.stackPanel1.Location = new System.Drawing.Point(0, 0);
this.stackPanel1.Name = "stackPanel1";
this.stackPanel1.Size = new System.Drawing.Size(724, 629);
this.stackPanel1.Size = new System.Drawing.Size(700, 629);
this.stackPanel1.TabIndex = 1;
this.stackPanel1.Text = "stackPanel1";
this.stackPanel1.Vertical = true;
@ -128,7 +128,7 @@
this.flowPanel7.Controls.Add(this.button39);
this.flowPanel7.Location = new System.Drawing.Point(3, 571);
this.flowPanel7.Name = "flowPanel7";
this.flowPanel7.Size = new System.Drawing.Size(718, 38);
this.flowPanel7.Size = new System.Drawing.Size(694, 38);
this.flowPanel7.TabIndex = 18;
this.flowPanel7.Text = "flowPanel7";
//
@ -150,7 +150,7 @@
this.label9.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label9.Location = new System.Drawing.Point(3, 541);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(718, 24);
this.label9.Size = new System.Drawing.Size(694, 24);
this.label9.TabIndex = 17;
this.label9.Text = "渐变按钮";
//
@ -160,7 +160,7 @@
this.flowPanel6.Controls.Add(this.panel2);
this.flowPanel6.Location = new System.Drawing.Point(3, 497);
this.flowPanel6.Name = "flowPanel6";
this.flowPanel6.Size = new System.Drawing.Size(718, 38);
this.flowPanel6.Size = new System.Drawing.Size(694, 38);
this.flowPanel6.TabIndex = 16;
this.flowPanel6.Text = "flowPanel6";
//
@ -258,7 +258,7 @@
this.label8.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label8.Location = new System.Drawing.Point(3, 467);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(718, 24);
this.label8.Size = new System.Drawing.Size(694, 24);
this.label8.TabIndex = 15;
this.label8.Text = "组合按钮";
//
@ -271,7 +271,7 @@
this.flowPanel5.Controls.Add(this.button29);
this.flowPanel5.Location = new System.Drawing.Point(3, 423);
this.flowPanel5.Name = "flowPanel5";
this.flowPanel5.Size = new System.Drawing.Size(718, 38);
this.flowPanel5.Size = new System.Drawing.Size(694, 38);
this.flowPanel5.TabIndex = 14;
this.flowPanel5.Text = "flowPanel5";
//
@ -348,7 +348,7 @@
this.label7.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label7.Location = new System.Drawing.Point(3, 393);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(718, 24);
this.label7.Size = new System.Drawing.Size(694, 24);
this.label7.TabIndex = 13;
this.label7.Text = "分割按钮";
//
@ -362,7 +362,7 @@
this.flowPanel4.Controls.Add(this.button24);
this.flowPanel4.Location = new System.Drawing.Point(3, 349);
this.flowPanel4.Name = "flowPanel4";
this.flowPanel4.Size = new System.Drawing.Size(718, 38);
this.flowPanel4.Size = new System.Drawing.Size(694, 38);
this.flowPanel4.TabIndex = 12;
this.flowPanel4.Text = "flowPanel4";
//
@ -447,7 +447,7 @@
this.label6.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label6.Location = new System.Drawing.Point(3, 319);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(718, 24);
this.label6.Size = new System.Drawing.Size(694, 24);
this.label6.TabIndex = 11;
this.label6.Text = "图标按钮";
//
@ -461,7 +461,7 @@
this.flowPanel3.Controls.Add(this.button18);
this.flowPanel3.Location = new System.Drawing.Point(3, 275);
this.flowPanel3.Name = "flowPanel3";
this.flowPanel3.Size = new System.Drawing.Size(718, 38);
this.flowPanel3.Size = new System.Drawing.Size(694, 38);
this.flowPanel3.TabIndex = 10;
this.flowPanel3.Text = "flowPanel3";
//
@ -547,7 +547,7 @@
this.label5.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label5.Location = new System.Drawing.Point(3, 245);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(718, 24);
this.label5.Size = new System.Drawing.Size(694, 24);
this.label5.TabIndex = 9;
this.label5.Text = "文本按钮(带边框)";
//
@ -561,7 +561,7 @@
this.flowPanel2.Controls.Add(this.button12);
this.flowPanel2.Location = new System.Drawing.Point(3, 201);
this.flowPanel2.Name = "flowPanel2";
this.flowPanel2.Size = new System.Drawing.Size(718, 38);
this.flowPanel2.Size = new System.Drawing.Size(694, 38);
this.flowPanel2.TabIndex = 8;
this.flowPanel2.Text = "flowPanel2";
//
@ -641,7 +641,7 @@
this.label4.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label4.Location = new System.Drawing.Point(3, 171);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(718, 24);
this.label4.Size = new System.Drawing.Size(694, 24);
this.label4.TabIndex = 7;
this.label4.Text = "文本按钮";
//
@ -655,7 +655,7 @@
this.flowPanel1.Controls.Add(this.button1);
this.flowPanel1.Location = new System.Drawing.Point(3, 127);
this.flowPanel1.Name = "flowPanel1";
this.flowPanel1.Size = new System.Drawing.Size(718, 38);
this.flowPanel1.Size = new System.Drawing.Size(694, 38);
this.flowPanel1.TabIndex = 6;
this.flowPanel1.Text = "flowPanel1";
//
@ -729,7 +729,7 @@
this.label3.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label3.Location = new System.Drawing.Point(3, 97);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(718, 24);
this.label3.Size = new System.Drawing.Size(694, 24);
this.label3.TabIndex = 5;
this.label3.Text = "按钮类型";
//
@ -737,7 +737,7 @@
//
this.divider1.Location = new System.Drawing.Point(3, 79);
this.divider1.Name = "divider1";
this.divider1.Size = new System.Drawing.Size(718, 12);
this.divider1.Size = new System.Drawing.Size(694, 12);
this.divider1.TabIndex = 4;
//
// label2
@ -745,7 +745,7 @@
this.label2.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(3, 49);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(718, 24);
this.label2.Size = new System.Drawing.Size(694, 24);
this.label2.TabIndex = 1;
this.label2.Text = "按钮用于开始一个即时操作。";
//
@ -754,7 +754,7 @@
this.label1.Font = new System.Drawing.Font("Microsoft YaHei UI", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(3, 3);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(718, 40);
this.label1.Size = new System.Drawing.Size(694, 40);
this.label1.TabIndex = 0;
this.label1.Text = "Button 按钮";
//
@ -762,8 +762,7 @@
//
this.Controls.Add(this.stackPanel1);
this.Name = "ButtonDemo";
this.Size = new System.Drawing.Size(724, 629);
this.Load += new System.EventHandler(this.ButtonDemo_Load);
this.Size = new System.Drawing.Size(700, 629);
this.stackPanel1.ResumeLayout(false);
this.flowPanel7.ResumeLayout(false);
this.flowPanel6.ResumeLayout(false);

View File

@ -11,10 +11,6 @@ namespace AntdUIDemo.Views
public ButtonDemo()
{
InitializeComponent();
}
private void ButtonDemo_Load(object sender, EventArgs e)
{
// 遍历窗体中的所有控件并绑定 tooltip
BindButtonWithToolTip(this);
}

View File

@ -63,6 +63,7 @@
this.buttonCZ = new AntdUI.Button();
this.buttonClose = new AntdUI.Button();
this.buttonOpen = new AntdUI.Button();
this.divider1 = new AntdUI.Divider();
this.label3 = new AntdUI.Label();
this.label2 = new AntdUI.Label();
this.label1 = new AntdUI.Label();
@ -83,13 +84,14 @@
this.stackPanel1.Controls.Add(this.stackPanel3);
this.stackPanel1.Controls.Add(this.label4);
this.stackPanel1.Controls.Add(this.stackPanel2);
this.stackPanel1.Controls.Add(this.divider1);
this.stackPanel1.Controls.Add(this.label3);
this.stackPanel1.Controls.Add(this.label2);
this.stackPanel1.Controls.Add(this.label1);
this.stackPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.stackPanel1.Location = new System.Drawing.Point(0, 0);
this.stackPanel1.Name = "stackPanel1";
this.stackPanel1.Size = new System.Drawing.Size(710, 372);
this.stackPanel1.Size = new System.Drawing.Size(700, 434);
this.stackPanel1.TabIndex = 0;
this.stackPanel1.Text = "stackPanel1";
this.stackPanel1.Vertical = true;
@ -102,10 +104,10 @@
this.stackPanel6.Controls.Add(this.label15);
this.stackPanel6.Controls.Add(this.input_badge);
this.stackPanel6.Controls.Add(this.label17);
this.stackPanel6.Location = new System.Drawing.Point(3, 327);
this.stackPanel6.Location = new System.Drawing.Point(3, 345);
this.stackPanel6.Name = "stackPanel6";
this.stackPanel6.Size = new System.Drawing.Size(704, 32);
this.stackPanel6.TabIndex = 12;
this.stackPanel6.Size = new System.Drawing.Size(694, 32);
this.stackPanel6.TabIndex = 20;
this.stackPanel6.Text = "stackPanel6";
//
// colorPicker
@ -176,10 +178,10 @@
this.stackPanel5.Controls.Add(this.label13);
this.stackPanel5.Controls.Add(this.select_shape);
this.stackPanel5.Controls.Add(this.label14);
this.stackPanel5.Location = new System.Drawing.Point(3, 289);
this.stackPanel5.Location = new System.Drawing.Point(3, 307);
this.stackPanel5.Name = "stackPanel5";
this.stackPanel5.Size = new System.Drawing.Size(704, 32);
this.stackPanel5.TabIndex = 11;
this.stackPanel5.Size = new System.Drawing.Size(694, 32);
this.stackPanel5.TabIndex = 19;
this.stackPanel5.Text = "stackPanel5";
//
// input_radius
@ -246,10 +248,10 @@
// label11
//
this.label11.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F);
this.label11.Location = new System.Drawing.Point(3, 259);
this.label11.Location = new System.Drawing.Point(3, 277);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(704, 24);
this.label11.TabIndex = 10;
this.label11.Size = new System.Drawing.Size(694, 24);
this.label11.TabIndex = 18;
this.label11.Text = "按钮配置";
//
// stackPanel4
@ -260,10 +262,10 @@
this.stackPanel4.Controls.Add(this.label7);
this.stackPanel4.Controls.Add(this.input_size);
this.stackPanel4.Controls.Add(this.label9);
this.stackPanel4.Location = new System.Drawing.Point(3, 221);
this.stackPanel4.Location = new System.Drawing.Point(3, 239);
this.stackPanel4.Name = "stackPanel4";
this.stackPanel4.Size = new System.Drawing.Size(704, 32);
this.stackPanel4.TabIndex = 9;
this.stackPanel4.Size = new System.Drawing.Size(694, 32);
this.stackPanel4.TabIndex = 17;
this.stackPanel4.Text = "stackPanel4";
//
// input_my
@ -343,10 +345,10 @@
this.stackPanel3.Controls.Add(this.label6);
this.stackPanel3.Controls.Add(this.select_align);
this.stackPanel3.Controls.Add(this.label10);
this.stackPanel3.Location = new System.Drawing.Point(3, 183);
this.stackPanel3.Location = new System.Drawing.Point(3, 201);
this.stackPanel3.Name = "stackPanel3";
this.stackPanel3.Size = new System.Drawing.Size(704, 32);
this.stackPanel3.TabIndex = 8;
this.stackPanel3.Size = new System.Drawing.Size(694, 32);
this.stackPanel3.TabIndex = 16;
this.stackPanel3.Text = "stackPanel3";
//
// select_vertical
@ -420,10 +422,10 @@
// label4
//
this.label4.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F);
this.label4.Location = new System.Drawing.Point(3, 153);
this.label4.Location = new System.Drawing.Point(3, 171);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(704, 24);
this.label4.TabIndex = 6;
this.label4.Size = new System.Drawing.Size(694, 24);
this.label4.TabIndex = 15;
this.label4.Text = "控件配置";
//
// stackPanel2
@ -431,10 +433,10 @@
this.stackPanel2.Controls.Add(this.buttonCZ);
this.stackPanel2.Controls.Add(this.buttonClose);
this.stackPanel2.Controls.Add(this.buttonOpen);
this.stackPanel2.Location = new System.Drawing.Point(3, 109);
this.stackPanel2.Location = new System.Drawing.Point(3, 127);
this.stackPanel2.Name = "stackPanel2";
this.stackPanel2.Size = new System.Drawing.Size(704, 38);
this.stackPanel2.TabIndex = 5;
this.stackPanel2.Size = new System.Drawing.Size(694, 38);
this.stackPanel2.TabIndex = 14;
this.stackPanel2.Text = "stackPanel2";
//
// buttonCZ
@ -447,7 +449,6 @@
this.buttonCZ.Text = "重 置";
this.buttonCZ.Type = AntdUI.TTypeMini.Warn;
this.buttonCZ.WaveSize = 0;
this.buttonCZ.Click += new System.EventHandler(this.buttonCZ_Click);
//
// buttonClose
//
@ -459,7 +460,6 @@
this.buttonClose.Text = "关 闭";
this.buttonClose.Type = AntdUI.TTypeMini.Error;
this.buttonClose.WaveSize = 0;
this.buttonClose.Click += new System.EventHandler(this.buttonClose_Click);
//
// buttonOpen
//
@ -471,14 +471,20 @@
this.buttonOpen.Text = "开 启";
this.buttonOpen.Type = AntdUI.TTypeMini.Primary;
this.buttonOpen.WaveSize = 0;
this.buttonOpen.Click += new System.EventHandler(this.buttonOpen_Click);
//
// divider1
//
this.divider1.Location = new System.Drawing.Point(3, 109);
this.divider1.Name = "divider1";
this.divider1.Size = new System.Drawing.Size(694, 12);
this.divider1.TabIndex = 13;
//
// label3
//
this.label3.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
this.label3.Location = new System.Drawing.Point(3, 79);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(704, 24);
this.label3.Size = new System.Drawing.Size(694, 24);
this.label3.TabIndex = 4;
this.label3.Text = "FloatButton没有工具箱控件使用代码方式调用。";
//
@ -487,7 +493,7 @@
this.label2.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(3, 49);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(704, 24);
this.label2.Size = new System.Drawing.Size(694, 24);
this.label2.TabIndex = 3;
this.label2.Text = "悬浮于页面上方的按钮。";
//
@ -496,16 +502,17 @@
this.label1.Font = new System.Drawing.Font("Microsoft YaHei UI", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(3, 3);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(704, 40);
this.label1.Size = new System.Drawing.Size(694, 40);
this.label1.TabIndex = 2;
this.label1.Text = "FloatButton 按钮";
this.label1.Text = "FloatButton 悬浮按钮";
//
// FloatButtonDemo
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.Controls.Add(this.stackPanel1);
this.Name = "FloatButtonDemo";
this.Size = new System.Drawing.Size(710, 372);
this.Size = new System.Drawing.Size(700, 434);
this.Load += new System.EventHandler(this.FloatButtonDemo_Load);
this.stackPanel1.ResumeLayout(false);
this.stackPanel6.ResumeLayout(false);
this.stackPanel5.ResumeLayout(false);
@ -522,9 +529,20 @@
private AntdUI.Label label1;
private AntdUI.Label label2;
private AntdUI.Label label3;
private AntdUI.StackPanel stackPanel2;
private AntdUI.Button buttonOpen;
private AntdUI.Button buttonClose;
private AntdUI.StackPanel stackPanel6;
private AntdUI.ColorPicker colorPicker;
private AntdUI.Label label16;
private AntdUI.InputNumber input_badgesize;
private AntdUI.Label label15;
private AntdUI.Input input_badge;
private AntdUI.Label label17;
private AntdUI.StackPanel stackPanel5;
private AntdUI.InputNumber input_radius;
private AntdUI.Label label12;
private AntdUI.Select select_type;
private AntdUI.Label label13;
private AntdUI.Select select_shape;
private AntdUI.Label label14;
private AntdUI.Label label11;
private AntdUI.StackPanel stackPanel4;
private AntdUI.InputNumber input_my;
@ -541,20 +559,10 @@
private AntdUI.Select select_align;
private AntdUI.Label label10;
private AntdUI.Label label4;
private AntdUI.StackPanel stackPanel5;
private AntdUI.InputNumber input_radius;
private AntdUI.Label label12;
private AntdUI.Select select_type;
private AntdUI.Label label13;
private AntdUI.Select select_shape;
private AntdUI.Label label14;
private AntdUI.StackPanel stackPanel6;
private AntdUI.Label label17;
private AntdUI.InputNumber input_badgesize;
private AntdUI.Label label15;
private AntdUI.Input input_badge;
private AntdUI.ColorPicker colorPicker;
private AntdUI.Label label16;
private AntdUI.StackPanel stackPanel2;
private AntdUI.Button buttonCZ;
private AntdUI.Button buttonClose;
private AntdUI.Button buttonOpen;
private AntdUI.Divider divider1;
}
}

View File

@ -16,9 +16,22 @@ namespace AntdUIDemo.Views
//初始化下拉框
InitSelectItems();
//设置默认值
SetDefaultSelectItem();
InitData();
// 绑定按钮事件
BindButtonClick();
}
private void FloatButtonDemo_Load(object sender, EventArgs e)
{
// 加载浮动按钮
LoadBaseFloatButton();
LoadFloatButton();
}
private void BindButtonClick()
{
buttonOpen.Click += buttonOpen_Click;
buttonClose.Click += buttonClose_Click;
buttonCZ.Click += buttonCZ_Click;
}
// 初始化下拉框
@ -45,7 +58,7 @@ namespace AntdUIDemo.Views
}
// 设置默认值
private void SetDefaultSelectItem()
private void InitData()
{
select_align.SelectedIndex = 7;
select_shape.SelectedIndex = 0;
@ -63,7 +76,7 @@ namespace AntdUIDemo.Views
}
// 加载浮动按钮
private void LoadBaseFloatButton()
private void LoadFloatButton()
{
if (floatButtonForm == null || floatButtonForm.IsDisposed)
{
@ -145,16 +158,16 @@ namespace AntdUIDemo.Views
// 重置
private void buttonCZ_Click(object sender, EventArgs e)
{
SetDefaultSelectItem();
InitData();
CloseFloatButtonForm();
LoadBaseFloatButton();
LoadFloatButton();
}
// 设置
private void buttonOpen_Click(object sender, EventArgs e)
{
CloseFloatButtonForm();
LoadBaseFloatButton();
LoadFloatButton();
}
// 关闭

View File

@ -31,24 +31,11 @@
this.stackPanel1 = new AntdUI.StackPanel();
this.stackPanel2 = new AntdUI.StackPanel();
this.flowPanel = new AntdUI.FlowPanel();
this.button14 = new AntdUI.Button();
this.button13 = new AntdUI.Button();
this.button12 = new AntdUI.Button();
this.button11 = new AntdUI.Button();
this.button10 = new AntdUI.Button();
this.button9 = new AntdUI.Button();
this.button8 = new AntdUI.Button();
this.button7 = new AntdUI.Button();
this.button6 = new AntdUI.Button();
this.button5 = new AntdUI.Button();
this.button4 = new AntdUI.Button();
this.button3 = new AntdUI.Button();
this.button1 = new AntdUI.Button();
this.button2 = new AntdUI.Button();
this.stackPanel3 = new AntdUI.StackPanel();
this.buttonCZ = new AntdUI.Button();
this.buttonDEL = new AntdUI.Button();
this.buttonADD = new AntdUI.Button();
this.buttonCZ = new AntdUI.Button();
this.buttonSZ = new AntdUI.Button();
this.stackPanel6 = new AntdUI.StackPanel();
this.select_autoscroll = new AntdUI.Select();
this.label4 = new AntdUI.Label();
@ -63,7 +50,6 @@
this.label1 = new AntdUI.Label();
this.stackPanel1.SuspendLayout();
this.stackPanel2.SuspendLayout();
this.flowPanel.SuspendLayout();
this.stackPanel3.SuspendLayout();
this.stackPanel6.SuspendLayout();
this.stackPanel5.SuspendLayout();
@ -79,7 +65,7 @@
this.stackPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.stackPanel1.Location = new System.Drawing.Point(0, 0);
this.stackPanel1.Name = "stackPanel1";
this.stackPanel1.Size = new System.Drawing.Size(707, 496);
this.stackPanel1.Size = new System.Drawing.Size(700, 496);
this.stackPanel1.TabIndex = 1;
this.stackPanel1.Text = "stackPanel1";
this.stackPanel1.Vertical = true;
@ -90,7 +76,7 @@
this.stackPanel2.Controls.Add(this.stackPanel3);
this.stackPanel2.Location = new System.Drawing.Point(3, 97);
this.stackPanel2.Name = "stackPanel2";
this.stackPanel2.Size = new System.Drawing.Size(701, 281);
this.stackPanel2.Size = new System.Drawing.Size(694, 279);
this.stackPanel2.TabIndex = 7;
this.stackPanel2.Text = "stackPanel2";
//
@ -98,229 +84,70 @@
//
this.flowPanel.BackColor = System.Drawing.Color.White;
this.flowPanel.Badge = "";
this.flowPanel.Controls.Add(this.button14);
this.flowPanel.Controls.Add(this.button13);
this.flowPanel.Controls.Add(this.button12);
this.flowPanel.Controls.Add(this.button11);
this.flowPanel.Controls.Add(this.button10);
this.flowPanel.Controls.Add(this.button9);
this.flowPanel.Controls.Add(this.button8);
this.flowPanel.Controls.Add(this.button7);
this.flowPanel.Controls.Add(this.button6);
this.flowPanel.Controls.Add(this.button5);
this.flowPanel.Controls.Add(this.button4);
this.flowPanel.Controls.Add(this.button3);
this.flowPanel.Controls.Add(this.button1);
this.flowPanel.Controls.Add(this.button2);
this.flowPanel.Location = new System.Drawing.Point(289, 3);
this.flowPanel.Name = "flowPanel";
this.flowPanel.Size = new System.Drawing.Size(396, 275);
this.flowPanel.Size = new System.Drawing.Size(400, 273);
this.flowPanel.TabIndex = 1;
//
// button14
//
this.button14.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button14.Location = new System.Drawing.Point(105, 147);
this.button14.Name = "button14";
this.button14.Size = new System.Drawing.Size(90, 42);
this.button14.TabIndex = 15;
this.button14.Text = "Button";
this.button14.Type = AntdUI.TTypeMini.Primary;
this.button14.WaveSize = 0;
//
// button13
//
this.button13.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button13.Location = new System.Drawing.Point(9, 147);
this.button13.Name = "button13";
this.button13.Size = new System.Drawing.Size(90, 42);
this.button13.TabIndex = 14;
this.button13.Text = "Button";
this.button13.Type = AntdUI.TTypeMini.Primary;
this.button13.WaveSize = 0;
//
// button12
//
this.button12.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button12.Location = new System.Drawing.Point(297, 99);
this.button12.Name = "button12";
this.button12.Size = new System.Drawing.Size(90, 42);
this.button12.TabIndex = 13;
this.button12.Text = "Button";
this.button12.Type = AntdUI.TTypeMini.Primary;
this.button12.WaveSize = 0;
//
// button11
//
this.button11.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button11.Location = new System.Drawing.Point(201, 99);
this.button11.Name = "button11";
this.button11.Size = new System.Drawing.Size(90, 42);
this.button11.TabIndex = 12;
this.button11.Text = "Button";
this.button11.Type = AntdUI.TTypeMini.Primary;
this.button11.WaveSize = 0;
//
// button10
//
this.button10.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button10.Location = new System.Drawing.Point(105, 99);
this.button10.Name = "button10";
this.button10.Size = new System.Drawing.Size(90, 42);
this.button10.TabIndex = 11;
this.button10.Text = "Button";
this.button10.Type = AntdUI.TTypeMini.Primary;
this.button10.WaveSize = 0;
//
// button9
//
this.button9.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button9.Location = new System.Drawing.Point(9, 99);
this.button9.Name = "button9";
this.button9.Size = new System.Drawing.Size(90, 42);
this.button9.TabIndex = 10;
this.button9.Text = "Button";
this.button9.Type = AntdUI.TTypeMini.Primary;
this.button9.WaveSize = 0;
//
// button8
//
this.button8.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button8.Location = new System.Drawing.Point(297, 51);
this.button8.Name = "button8";
this.button8.Size = new System.Drawing.Size(90, 42);
this.button8.TabIndex = 9;
this.button8.Text = "Button";
this.button8.Type = AntdUI.TTypeMini.Primary;
this.button8.WaveSize = 0;
//
// button7
//
this.button7.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button7.Location = new System.Drawing.Point(201, 51);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(90, 42);
this.button7.TabIndex = 8;
this.button7.Text = "Button";
this.button7.Type = AntdUI.TTypeMini.Primary;
this.button7.WaveSize = 0;
//
// button6
//
this.button6.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button6.Location = new System.Drawing.Point(105, 51);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(90, 42);
this.button6.TabIndex = 7;
this.button6.Text = "Button";
this.button6.Type = AntdUI.TTypeMini.Primary;
this.button6.WaveSize = 0;
//
// button5
//
this.button5.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button5.Location = new System.Drawing.Point(9, 51);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(90, 42);
this.button5.TabIndex = 6;
this.button5.Text = "Button";
this.button5.Type = AntdUI.TTypeMini.Primary;
this.button5.WaveSize = 0;
//
// button4
//
this.button4.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button4.Location = new System.Drawing.Point(297, 3);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(90, 42);
this.button4.TabIndex = 5;
this.button4.Text = "Button";
this.button4.Type = AntdUI.TTypeMini.Primary;
this.button4.WaveSize = 0;
//
// button3
//
this.button3.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button3.Location = new System.Drawing.Point(201, 3);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(90, 42);
this.button3.TabIndex = 4;
this.button3.Text = "Button";
this.button3.Type = AntdUI.TTypeMini.Primary;
this.button3.WaveSize = 0;
//
// button1
//
this.button1.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button1.Location = new System.Drawing.Point(105, 3);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(90, 42);
this.button1.TabIndex = 3;
this.button1.Text = "Button";
this.button1.Type = AntdUI.TTypeMini.Primary;
this.button1.WaveSize = 0;
//
// button2
//
this.button2.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button2.Location = new System.Drawing.Point(9, 3);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(90, 42);
this.button2.TabIndex = 2;
this.button2.Text = "Button";
this.button2.Type = AntdUI.TTypeMini.Primary;
this.button2.WaveSize = 0;
//
// stackPanel3
//
this.stackPanel3.Controls.Add(this.buttonCZ);
this.stackPanel3.Controls.Add(this.buttonDEL);
this.stackPanel3.Controls.Add(this.buttonADD);
this.stackPanel3.Controls.Add(this.buttonCZ);
this.stackPanel3.Controls.Add(this.buttonSZ);
this.stackPanel3.Controls.Add(this.stackPanel6);
this.stackPanel3.Controls.Add(this.stackPanel5);
this.stackPanel3.Controls.Add(this.stackPanel4);
this.stackPanel3.Location = new System.Drawing.Point(3, 3);
this.stackPanel3.Name = "stackPanel3";
this.stackPanel3.Size = new System.Drawing.Size(280, 275);
this.stackPanel3.Size = new System.Drawing.Size(280, 273);
this.stackPanel3.TabIndex = 0;
this.stackPanel3.Text = "stackPanel3";
this.stackPanel3.Vertical = true;
//
// buttonCZ
//
this.buttonCZ.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonCZ.Location = new System.Drawing.Point(3, 193);
this.buttonCZ.Name = "buttonCZ";
this.buttonCZ.Size = new System.Drawing.Size(274, 32);
this.buttonCZ.TabIndex = 15;
this.buttonCZ.Text = "重 置";
this.buttonCZ.Type = AntdUI.TTypeMini.Warn;
this.buttonCZ.WaveSize = 0;
this.buttonCZ.Click += new System.EventHandler(this.buttonCZ_Click);
//
// buttonDEL
//
this.buttonDEL.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonDEL.Location = new System.Drawing.Point(3, 155);
this.buttonDEL.Location = new System.Drawing.Point(3, 231);
this.buttonDEL.Name = "buttonDEL";
this.buttonDEL.Size = new System.Drawing.Size(274, 32);
this.buttonDEL.TabIndex = 14;
this.buttonDEL.Text = "删除按钮";
this.buttonDEL.TabIndex = 36;
this.buttonDEL.Text = "删除 Button";
this.buttonDEL.Type = AntdUI.TTypeMini.Error;
this.buttonDEL.WaveSize = 0;
this.buttonDEL.Click += new System.EventHandler(this.buttonDEL_Click);
//
// buttonADD
//
this.buttonADD.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonADD.Location = new System.Drawing.Point(3, 117);
this.buttonADD.Location = new System.Drawing.Point(3, 193);
this.buttonADD.Name = "buttonADD";
this.buttonADD.Size = new System.Drawing.Size(274, 32);
this.buttonADD.TabIndex = 13;
this.buttonADD.Text = "添加按钮";
this.buttonADD.Type = AntdUI.TTypeMini.Primary;
this.buttonADD.TabIndex = 35;
this.buttonADD.Text = "添加 Button";
this.buttonADD.Type = AntdUI.TTypeMini.Info;
this.buttonADD.WaveSize = 0;
this.buttonADD.Click += new System.EventHandler(this.buttonADD_Click);
//
// buttonCZ
//
this.buttonCZ.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonCZ.Location = new System.Drawing.Point(3, 155);
this.buttonCZ.Name = "buttonCZ";
this.buttonCZ.Size = new System.Drawing.Size(274, 32);
this.buttonCZ.TabIndex = 34;
this.buttonCZ.Text = "重 置";
this.buttonCZ.Type = AntdUI.TTypeMini.Warn;
this.buttonCZ.WaveSize = 0;
//
// buttonSZ
//
this.buttonSZ.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonSZ.Location = new System.Drawing.Point(3, 117);
this.buttonSZ.Name = "buttonSZ";
this.buttonSZ.Size = new System.Drawing.Size(274, 32);
this.buttonSZ.TabIndex = 33;
this.buttonSZ.Text = "设 置";
this.buttonSZ.Type = AntdUI.TTypeMini.Primary;
this.buttonSZ.WaveSize = 0;
//
// stackPanel6
//
@ -343,11 +170,10 @@
this.select_autoscroll.Name = "select_autoscroll";
this.select_autoscroll.SelectedIndex = 1;
this.select_autoscroll.SelectedValue = "False";
this.select_autoscroll.Size = new System.Drawing.Size(105, 26);
this.select_autoscroll.Size = new System.Drawing.Size(175, 26);
this.select_autoscroll.TabIndex = 11;
this.select_autoscroll.Text = "False";
this.select_autoscroll.WaveSize = 1;
this.select_autoscroll.SelectedIndexChanged += new AntdUI.IntEventHandler(this.select_autoscroll_SelectedIndexChanged);
//
// label4
//
@ -373,11 +199,10 @@
this.input_gap.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
this.input_gap.Location = new System.Drawing.Point(97, 3);
this.input_gap.Name = "input_gap";
this.input_gap.Size = new System.Drawing.Size(105, 26);
this.input_gap.Size = new System.Drawing.Size(175, 26);
this.input_gap.TabIndex = 5;
this.input_gap.Text = "0";
this.input_gap.WaveSize = 1;
this.input_gap.ValueChanged += new AntdUI.DecimalEventHandler(this.input_gap_ValueChanged);
//
// label3
//
@ -404,10 +229,9 @@
this.select_align.List = true;
this.select_align.Location = new System.Drawing.Point(97, 3);
this.select_align.Name = "select_align";
this.select_align.Size = new System.Drawing.Size(105, 26);
this.select_align.Size = new System.Drawing.Size(175, 26);
this.select_align.TabIndex = 11;
this.select_align.WaveSize = 1;
this.select_align.SelectedIndexChanged += new AntdUI.IntEventHandler(this.select_align_SelectedIndexChanged);
//
// label10
//
@ -422,7 +246,7 @@
//
this.divider1.Location = new System.Drawing.Point(3, 79);
this.divider1.Name = "divider1";
this.divider1.Size = new System.Drawing.Size(701, 12);
this.divider1.Size = new System.Drawing.Size(694, 12);
this.divider1.TabIndex = 6;
//
// label2
@ -430,7 +254,7 @@
this.label2.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(3, 49);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(701, 24);
this.label2.Size = new System.Drawing.Size(694, 24);
this.label2.TabIndex = 5;
this.label2.Text = "用于对齐的弹性布局容器。";
//
@ -439,7 +263,7 @@
this.label1.Font = new System.Drawing.Font("Microsoft YaHei UI", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(3, 3);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(701, 40);
this.label1.Size = new System.Drawing.Size(694, 40);
this.label1.TabIndex = 4;
this.label1.Text = "FlowPanel 流动布局";
//
@ -448,10 +272,10 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.Controls.Add(this.stackPanel1);
this.Name = "FlowPanelDemo";
this.Size = new System.Drawing.Size(707, 496);
this.Size = new System.Drawing.Size(700, 496);
this.Load += new System.EventHandler(this.FlowPanelDemo_Load);
this.stackPanel1.ResumeLayout(false);
this.stackPanel2.ResumeLayout(false);
this.flowPanel.ResumeLayout(false);
this.stackPanel3.ResumeLayout(false);
this.stackPanel6.ResumeLayout(false);
this.stackPanel5.ResumeLayout(false);
@ -469,15 +293,6 @@
private AntdUI.StackPanel stackPanel2;
private AntdUI.FlowPanel flowPanel;
private AntdUI.StackPanel stackPanel3;
private AntdUI.Button button9;
private AntdUI.Button button8;
private AntdUI.Button button7;
private AntdUI.Button button6;
private AntdUI.Button button5;
private AntdUI.Button button4;
private AntdUI.Button button3;
private AntdUI.Button button1;
private AntdUI.Button button2;
private AntdUI.StackPanel stackPanel4;
private AntdUI.Label label10;
private AntdUI.Select select_align;
@ -487,13 +302,9 @@
private AntdUI.StackPanel stackPanel6;
private AntdUI.Select select_autoscroll;
private AntdUI.Label label4;
private AntdUI.Button button14;
private AntdUI.Button button13;
private AntdUI.Button button12;
private AntdUI.Button button11;
private AntdUI.Button button10;
private AntdUI.Button buttonCZ;
private AntdUI.Button buttonSZ;
private AntdUI.Button buttonDEL;
private AntdUI.Button buttonADD;
private AntdUI.Button buttonCZ;
}
}

View File

@ -7,15 +7,68 @@ namespace AntdUIDemo.Views
{
public partial class FlowPanelDemo : UserControl
{
private AntdUI.Window form;
private Window form;
public FlowPanelDemo(Window _form)
{
form = _form;
InitializeComponent();
//初始化下拉框
InitSelectItems();
//设置默认值
InitData();
// 绑定按钮事件
BindButtonClick();
}
private void FlowPanelDemo_Load(object sender, EventArgs e)
{
//初始化FlowPanel
LoadFlowPanel();
}
//初始化panel
private void LoadFlowPanel()
{
flowPanel.Align = (TAlignFlow)select_align.SelectedValue;
flowPanel.Gap = (int)input_gap.Value;
flowPanel.AutoScroll = select_autoscroll.SelectedIndex == 0;
flowPanel.Controls.Clear();
for (int i = 0; i < 14; i++)
{
var control = new AntdUI.Button()
{
Text = "Button",
Type = TTypeMini.Primary,
WaveSize = 0,
Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(134))),
Size = new Size(90, 42),
};
// 通过主窗口设置DPI控制添加控件保持缩放比例
form.AutoDpi(control);
flowPanel.Controls.Add(control);
}
}
// 设置默认值
private void InitData()
{
select_align.SelectedIndex = 0;
input_gap.Value = 0;
select_autoscroll.SelectedIndex = 1;
}
// 绑定按钮事件
private void BindButtonClick()
{
buttonSZ.Click += buttonSZ_Click;
buttonCZ.Click += buttonCZ_Click;
buttonADD.Click += buttonADD_Click;
buttonDEL.Click += buttonDEL_Click;
}
// 初始化下拉框
private void InitSelectItems()
{
//初始化方向
@ -24,25 +77,6 @@ namespace AntdUIDemo.Views
{
select_align.Items.Add(align);
}
select_align.SelectedIndex = 0;
}
// 选择对齐方式
private void select_align_SelectedIndexChanged(object sender, int value)
{
flowPanel.Align = (TAlignFlow)select_align.SelectedValue;
}
// 输入间隔
private void input_gap_ValueChanged(object sender, decimal value)
{
flowPanel.Invoke((MethodInvoker)(() => flowPanel.Gap = (int)value));
}
// 是否添加滚动
private void select_autoscroll_SelectedIndexChanged(object sender, int value)
{
flowPanel.AutoScroll = select_autoscroll.SelectedIndex == 0;
}
// 添加按钮
@ -71,28 +105,20 @@ namespace AntdUIDemo.Views
}
}
// 设置
private void buttonSZ_Click(object sender, EventArgs e)
{
flowPanel.Align = (TAlignFlow)select_align.SelectedValue;
flowPanel.Gap = (int)input_gap.Value;
flowPanel.AutoScroll = select_autoscroll.SelectedIndex == 0;
}
// 重置
private void buttonCZ_Click(object sender, EventArgs e)
{
select_align.SelectedIndex = 0;
input_gap.Value = 0;
select_autoscroll.SelectedIndex = 1;
flowPanel.Controls.Clear();
for (int i = 0; i < 14; i++)
{
var control = new AntdUI.Button()
{
Text = "Button",
Type = TTypeMini.Primary,
WaveSize = 0,
Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(134))),
Size = new Size(90, 42),
};
form.AutoDpi(control);
flowPanel.Controls.Add(control);
}
InitData();
LoadFlowPanel();
}
}
}

View File

@ -31,13 +31,9 @@
this.stackPanel1 = new AntdUI.StackPanel();
this.stackPanel2 = new AntdUI.StackPanel();
this.gridPanel = new AntdUI.GridPanel();
this.button5 = new AntdUI.Button();
this.button4 = new AntdUI.Button();
this.button3 = new AntdUI.Button();
this.button2 = new AntdUI.Button();
this.stackPanel3 = new AntdUI.StackPanel();
this.buttonCZ = new AntdUI.Button();
this.buttonSPAN = new AntdUI.Button();
this.buttonSZ = new AntdUI.Button();
this.stackPanel4 = new AntdUI.StackPanel();
this.input_gap = new AntdUI.InputNumber();
this.label4 = new AntdUI.Label();
@ -49,7 +45,6 @@
this.label1 = new AntdUI.Label();
this.stackPanel1.SuspendLayout();
this.stackPanel2.SuspendLayout();
this.gridPanel.SuspendLayout();
this.stackPanel3.SuspendLayout();
this.stackPanel4.SuspendLayout();
this.stackPanel5.SuspendLayout();
@ -64,7 +59,7 @@
this.stackPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.stackPanel1.Location = new System.Drawing.Point(0, 0);
this.stackPanel1.Name = "stackPanel1";
this.stackPanel1.Size = new System.Drawing.Size(683, 475);
this.stackPanel1.Size = new System.Drawing.Size(700, 475);
this.stackPanel1.TabIndex = 0;
this.stackPanel1.Text = "stackPanel1";
this.stackPanel1.Vertical = true;
@ -75,71 +70,23 @@
this.stackPanel2.Controls.Add(this.stackPanel3);
this.stackPanel2.Location = new System.Drawing.Point(3, 97);
this.stackPanel2.Name = "stackPanel2";
this.stackPanel2.Size = new System.Drawing.Size(677, 299);
this.stackPanel2.Size = new System.Drawing.Size(694, 299);
this.stackPanel2.TabIndex = 9;
this.stackPanel2.Text = "stackPanel2";
//
// gridPanel
//
this.gridPanel.BackColor = System.Drawing.Color.White;
this.gridPanel.Controls.Add(this.button5);
this.gridPanel.Controls.Add(this.button4);
this.gridPanel.Controls.Add(this.button3);
this.gridPanel.Controls.Add(this.button2);
this.gridPanel.Location = new System.Drawing.Point(289, 3);
this.gridPanel.Name = "gridPanel";
this.gridPanel.Size = new System.Drawing.Size(384, 293);
this.gridPanel.Size = new System.Drawing.Size(400, 293);
this.gridPanel.TabIndex = 1;
this.gridPanel.Text = "gridPanel1";
//
// button5
//
this.button5.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button5.Location = new System.Drawing.Point(195, 149);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(186, 140);
this.button5.TabIndex = 6;
this.button5.Text = "Button";
this.button5.Type = AntdUI.TTypeMini.Primary;
this.button5.WaveSize = 0;
//
// button4
//
this.button4.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button4.Location = new System.Drawing.Point(3, 149);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(186, 140);
this.button4.TabIndex = 5;
this.button4.Text = "Button";
this.button4.Type = AntdUI.TTypeMini.Primary;
this.button4.WaveSize = 0;
//
// button3
//
this.button3.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button3.Location = new System.Drawing.Point(195, 3);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(186, 140);
this.button3.TabIndex = 4;
this.button3.Text = "Button";
this.button3.Type = AntdUI.TTypeMini.Primary;
this.button3.WaveSize = 0;
//
// button2
//
this.button2.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button2.Location = new System.Drawing.Point(3, 3);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(186, 140);
this.button2.TabIndex = 3;
this.button2.Text = "Button";
this.button2.Type = AntdUI.TTypeMini.Primary;
this.button2.WaveSize = 0;
//
// stackPanel3
//
this.stackPanel3.Controls.Add(this.buttonCZ);
this.stackPanel3.Controls.Add(this.buttonSPAN);
this.stackPanel3.Controls.Add(this.buttonSZ);
this.stackPanel3.Controls.Add(this.stackPanel4);
this.stackPanel3.Controls.Add(this.stackPanel5);
this.stackPanel3.Location = new System.Drawing.Point(3, 3);
@ -152,32 +99,30 @@
// buttonCZ
//
this.buttonCZ.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonCZ.Location = new System.Drawing.Point(3, 206);
this.buttonCZ.Location = new System.Drawing.Point(3, 136);
this.buttonCZ.Name = "buttonCZ";
this.buttonCZ.Size = new System.Drawing.Size(274, 32);
this.buttonCZ.TabIndex = 20;
this.buttonCZ.Text = "重 置";
this.buttonCZ.Type = AntdUI.TTypeMini.Warn;
this.buttonCZ.WaveSize = 0;
this.buttonCZ.Click += new System.EventHandler(this.buttonCZ_Click);
//
// buttonSPAN
// buttonSZ
//
this.buttonSPAN.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonSPAN.Location = new System.Drawing.Point(3, 168);
this.buttonSPAN.Name = "buttonSPAN";
this.buttonSPAN.Size = new System.Drawing.Size(274, 32);
this.buttonSPAN.TabIndex = 19;
this.buttonSPAN.Text = "设 置";
this.buttonSPAN.Type = AntdUI.TTypeMini.Primary;
this.buttonSPAN.WaveSize = 0;
this.buttonSPAN.Click += new System.EventHandler(this.buttonSPAN_Click);
this.buttonSZ.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonSZ.Location = new System.Drawing.Point(3, 98);
this.buttonSZ.Name = "buttonSZ";
this.buttonSZ.Size = new System.Drawing.Size(274, 32);
this.buttonSZ.TabIndex = 19;
this.buttonSZ.Text = "设 置";
this.buttonSZ.Type = AntdUI.TTypeMini.Primary;
this.buttonSZ.WaveSize = 0;
//
// stackPanel4
//
this.stackPanel4.Controls.Add(this.input_gap);
this.stackPanel4.Controls.Add(this.label4);
this.stackPanel4.Location = new System.Drawing.Point(3, 130);
this.stackPanel4.Location = new System.Drawing.Point(3, 60);
this.stackPanel4.Name = "stackPanel4";
this.stackPanel4.Size = new System.Drawing.Size(274, 32);
this.stackPanel4.TabIndex = 18;
@ -208,7 +153,7 @@
this.stackPanel5.Controls.Add(this.label3);
this.stackPanel5.Location = new System.Drawing.Point(3, 3);
this.stackPanel5.Name = "stackPanel5";
this.stackPanel5.Size = new System.Drawing.Size(274, 121);
this.stackPanel5.Size = new System.Drawing.Size(274, 51);
this.stackPanel5.TabIndex = 15;
this.stackPanel5.Text = "stackPanel5";
//
@ -218,7 +163,8 @@
this.input_span.Location = new System.Drawing.Point(97, 3);
this.input_span.Multiline = true;
this.input_span.Name = "input_span";
this.input_span.Size = new System.Drawing.Size(175, 115);
this.input_span.PlaceholderText = "分号隔开为行,空格隔开为列(可设置固定值或百分号)";
this.input_span.Size = new System.Drawing.Size(175, 45);
this.input_span.TabIndex = 5;
this.input_span.Text = "50% 50%;50% 50%";
this.input_span.WaveSize = 0;
@ -228,7 +174,7 @@
this.label3.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label3.Location = new System.Drawing.Point(3, 3);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(88, 115);
this.label3.Size = new System.Drawing.Size(88, 45);
this.label3.TabIndex = 4;
this.label3.Text = "Span";
//
@ -236,7 +182,7 @@
//
this.divider1.Location = new System.Drawing.Point(3, 79);
this.divider1.Name = "divider1";
this.divider1.Size = new System.Drawing.Size(677, 12);
this.divider1.Size = new System.Drawing.Size(694, 12);
this.divider1.TabIndex = 8;
//
// label2
@ -244,7 +190,7 @@
this.label2.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(3, 49);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(677, 24);
this.label2.Size = new System.Drawing.Size(694, 24);
this.label2.TabIndex = 7;
this.label2.Text = "精准划分区域的网格布局容器。";
//
@ -253,7 +199,7 @@
this.label1.Font = new System.Drawing.Font("Microsoft YaHei UI", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(3, 3);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(677, 40);
this.label1.Size = new System.Drawing.Size(694, 40);
this.label1.TabIndex = 6;
this.label1.Text = "GridPanel 网格布局";
//
@ -261,10 +207,10 @@
//
this.Controls.Add(this.stackPanel1);
this.Name = "GridPanelDemo";
this.Size = new System.Drawing.Size(683, 475);
this.Size = new System.Drawing.Size(700, 475);
this.Load += new System.EventHandler(this.GridPanelDemo_Load);
this.stackPanel1.ResumeLayout(false);
this.stackPanel2.ResumeLayout(false);
this.gridPanel.ResumeLayout(false);
this.stackPanel3.ResumeLayout(false);
this.stackPanel4.ResumeLayout(false);
this.stackPanel5.ResumeLayout(false);
@ -284,14 +230,10 @@
private AntdUI.Input input_span;
private AntdUI.Label label3;
private AntdUI.GridPanel gridPanel;
private AntdUI.Button buttonCZ;
private AntdUI.Button buttonSPAN;
private AntdUI.Button buttonSZ;
private AntdUI.StackPanel stackPanel4;
private AntdUI.InputNumber input_gap;
private AntdUI.Label label4;
private AntdUI.Button button5;
private AntdUI.Button button4;
private AntdUI.Button button3;
private AntdUI.Button button2;
private AntdUI.Button buttonCZ;
}
}

View File

@ -10,9 +10,30 @@ namespace AntdUIDemo.Views
public GridPanelDemo()
{
InitializeComponent();
//设置默认值
InitData();
// 绑定按钮事件
BindButtonClick();
}
private void buttonSPAN_Click(object sender, EventArgs e)
private void GridPanelDemo_Load(object sender, EventArgs e)
{
LoadGridPanel(input_span.Text, input_gap.Value);
}
private void InitData()
{
input_gap.Value = 0;
input_span.Text = "50% 50%;50% 50%";
}
private void BindButtonClick()
{
buttonSZ.Click += buttonSZ_Click;
buttonCZ.Click += buttonCZ_Click;
}
private void buttonSZ_Click(object sender, EventArgs e)
{
LoadGridPanel(input_span.Text, input_gap.Value);
}
@ -37,10 +58,9 @@ namespace AntdUIDemo.Views
private void buttonCZ_Click(object sender, EventArgs e)
{
input_gap.Value = 0;
var span = "50% 50%;50% 50%";
input_span.Text = span;
LoadGridPanel(span, 0);
InitData();
LoadGridPanel(input_span.Text, 0);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,19 @@ namespace AntdUIDemo.Views
InitSelectItems();
// 设置默认值
InitData();
// 绑定按钮事件
BindButtonClick();
}
private void BindButtonClick()
{
buttonSZ.Click += buttonSZ_Click;
buttonCZ.Click += buttonCZ_Click;
}
private void PanelDemo_Load(object sender, EventArgs e)
{
LoadPanel();
}
private void InitSelectItems()
@ -35,6 +48,7 @@ namespace AntdUIDemo.Views
private void buttonCZ_Click(object sender, EventArgs e)
{
InitData();
LoadPanel();
}
// 设置默认值
@ -46,13 +60,13 @@ namespace AntdUIDemo.Views
input_arrowsize.Value = 8;
input_radius.Value = 6;
input_shadow.Value = 12;
colorPicker.Value = Style.Db.TextBase;
colorPicker_shadow.Value = Style.Db.TextBase;
colorPicker_border.Value = Style.Db.BorderColor;
input_borderwidth.Value = 0;
input_shadowX.Value = 0;
input_shadowY.Value = 0;
input_shadowO.Value = (decimal)0.2;
input_shadowOH.Value = (decimal)0.3;
LoadPanel();
}
// 设置
@ -64,16 +78,21 @@ namespace AntdUIDemo.Views
private void LoadPanel()
{
panel.ArrowAlign = (TAlign)select_arrowalign.SelectedValue;
// TODO: 1.5.2版本 ArrowSize存在bug无法赋值更新,暂时使用panel.Invalidate();强制刷新,待更新后移除
panel.ArrowSize = (int)input_arrowsize.Value;
panel.Radius = (int)input_radius.Value;
panel.BorderWidth = (float)input_borderwidth.Value;
panel.BorderColor = colorPicker_border.Value;
panel.Shadow = (int)input_shadow.Value;
panel.ShadowAlign = (TAlignMini)select_shadowalign.SelectedValue;
panel.ShadowColor = colorPicker.Value;
panel.ShadowColor = colorPicker_shadow.Value;
panel.ShadowOffsetX = (int)input_shadowX.Value;
panel.ShadowOffsetY = (int)input_shadowY.Value;
panel.ShadowOpacity = (float)input_shadowO.Value;
panel.ShadowOpacityAnimation = select_shadowOA.SelectedIndex == 0;
panel.ShadowOpacityHover = (float)input_shadowOH.Value;
panel.Invalidate();
}
}
}

355
Views/StackPanelDemo.Designer.cs generated Normal file
View File

@ -0,0 +1,355 @@
namespace AntdUIDemo.Views
{
partial class StackPanelDemo
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.stackPanel1 = new AntdUI.StackPanel();
this.label2 = new AntdUI.Label();
this.label1 = new AntdUI.Label();
this.divider1 = new AntdUI.Divider();
this.stackPanel2 = new AntdUI.StackPanel();
this.stackPanel3 = new AntdUI.StackPanel();
this.stackPanel = new AntdUI.StackPanel();
this.stackPanel6 = new AntdUI.StackPanel();
this.select_autoscroll = new AntdUI.Select();
this.label4 = new AntdUI.Label();
this.stackPanel5 = new AntdUI.StackPanel();
this.input_gap = new AntdUI.InputNumber();
this.label3 = new AntdUI.Label();
this.stackPanel7 = new AntdUI.StackPanel();
this.label5 = new AntdUI.Label();
this.stackPanel8 = new AntdUI.StackPanel();
this.select_vertical = new AntdUI.Select();
this.label6 = new AntdUI.Label();
this.buttonCZ = new AntdUI.Button();
this.buttonSZ = new AntdUI.Button();
this.buttonDEL = new AntdUI.Button();
this.buttonADD = new AntdUI.Button();
this.input_itemsize = new AntdUI.Input();
this.stackPanel1.SuspendLayout();
this.stackPanel2.SuspendLayout();
this.stackPanel3.SuspendLayout();
this.stackPanel6.SuspendLayout();
this.stackPanel5.SuspendLayout();
this.stackPanel7.SuspendLayout();
this.stackPanel8.SuspendLayout();
this.SuspendLayout();
//
// stackPanel1
//
this.stackPanel1.Controls.Add(this.stackPanel2);
this.stackPanel1.Controls.Add(this.divider1);
this.stackPanel1.Controls.Add(this.label2);
this.stackPanel1.Controls.Add(this.label1);
this.stackPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.stackPanel1.Location = new System.Drawing.Point(0, 0);
this.stackPanel1.Name = "stackPanel1";
this.stackPanel1.Size = new System.Drawing.Size(700, 531);
this.stackPanel1.TabIndex = 0;
this.stackPanel1.Text = "stackPanel1";
this.stackPanel1.Vertical = true;
//
// label2
//
this.label2.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(3, 49);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(694, 24);
this.label2.TabIndex = 9;
this.label2.Text = "将子元素排列成水平或垂直的一行。";
//
// label1
//
this.label1.Font = new System.Drawing.Font("Microsoft YaHei UI", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(3, 3);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(694, 40);
this.label1.TabIndex = 8;
this.label1.Text = "StackPanel 堆叠布局";
//
// divider1
//
this.divider1.Location = new System.Drawing.Point(3, 79);
this.divider1.Name = "divider1";
this.divider1.Size = new System.Drawing.Size(694, 12);
this.divider1.TabIndex = 10;
//
// stackPanel2
//
this.stackPanel2.Controls.Add(this.stackPanel);
this.stackPanel2.Controls.Add(this.stackPanel3);
this.stackPanel2.Location = new System.Drawing.Point(3, 97);
this.stackPanel2.Name = "stackPanel2";
this.stackPanel2.Size = new System.Drawing.Size(694, 406);
this.stackPanel2.TabIndex = 11;
this.stackPanel2.Text = "stackPanel2";
//
// stackPanel3
//
this.stackPanel3.Controls.Add(this.buttonDEL);
this.stackPanel3.Controls.Add(this.buttonADD);
this.stackPanel3.Controls.Add(this.buttonCZ);
this.stackPanel3.Controls.Add(this.buttonSZ);
this.stackPanel3.Controls.Add(this.stackPanel8);
this.stackPanel3.Controls.Add(this.stackPanel7);
this.stackPanel3.Controls.Add(this.stackPanel5);
this.stackPanel3.Controls.Add(this.stackPanel6);
this.stackPanel3.Location = new System.Drawing.Point(3, 3);
this.stackPanel3.Name = "stackPanel3";
this.stackPanel3.Size = new System.Drawing.Size(280, 400);
this.stackPanel3.TabIndex = 0;
this.stackPanel3.Text = "stackPanel3";
this.stackPanel3.Vertical = true;
//
// stackPanel
//
this.stackPanel.BackColor = System.Drawing.Color.White;
this.stackPanel.ItemSize = "";
this.stackPanel.Location = new System.Drawing.Point(289, 3);
this.stackPanel.Name = "stackPanel";
this.stackPanel.Size = new System.Drawing.Size(400, 400);
this.stackPanel.TabIndex = 1;
this.stackPanel.Vertical = true;
//
// stackPanel6
//
this.stackPanel6.Controls.Add(this.select_autoscroll);
this.stackPanel6.Controls.Add(this.label4);
this.stackPanel6.Location = new System.Drawing.Point(3, 3);
this.stackPanel6.Name = "stackPanel6";
this.stackPanel6.Size = new System.Drawing.Size(274, 32);
this.stackPanel6.TabIndex = 12;
this.stackPanel6.Text = "stackPanel6";
//
// select_autoscroll
//
this.select_autoscroll.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.select_autoscroll.Items.AddRange(new object[] {
"True",
"False"});
this.select_autoscroll.List = true;
this.select_autoscroll.Location = new System.Drawing.Point(97, 3);
this.select_autoscroll.Name = "select_autoscroll";
this.select_autoscroll.SelectedIndex = 1;
this.select_autoscroll.SelectedValue = "False";
this.select_autoscroll.Size = new System.Drawing.Size(175, 26);
this.select_autoscroll.TabIndex = 11;
this.select_autoscroll.Text = "False";
this.select_autoscroll.WaveSize = 1;
//
// label4
//
this.label4.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label4.Location = new System.Drawing.Point(3, 3);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(88, 26);
this.label4.TabIndex = 4;
this.label4.Text = "AutoScroll";
//
// stackPanel5
//
this.stackPanel5.Controls.Add(this.input_gap);
this.stackPanel5.Controls.Add(this.label3);
this.stackPanel5.Location = new System.Drawing.Point(3, 41);
this.stackPanel5.Name = "stackPanel5";
this.stackPanel5.Size = new System.Drawing.Size(274, 32);
this.stackPanel5.TabIndex = 19;
this.stackPanel5.Text = "stackPanel5";
//
// input_gap
//
this.input_gap.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
this.input_gap.Location = new System.Drawing.Point(97, 3);
this.input_gap.Name = "input_gap";
this.input_gap.Size = new System.Drawing.Size(175, 26);
this.input_gap.TabIndex = 5;
this.input_gap.Text = "0";
this.input_gap.WaveSize = 1;
//
// label3
//
this.label3.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label3.Location = new System.Drawing.Point(3, 3);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(88, 26);
this.label3.TabIndex = 4;
this.label3.Text = "Gap";
//
// stackPanel7
//
this.stackPanel7.Controls.Add(this.input_itemsize);
this.stackPanel7.Controls.Add(this.label5);
this.stackPanel7.Location = new System.Drawing.Point(3, 79);
this.stackPanel7.Name = "stackPanel7";
this.stackPanel7.Size = new System.Drawing.Size(274, 32);
this.stackPanel7.TabIndex = 20;
this.stackPanel7.Text = "stackPanel7";
//
// label5
//
this.label5.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label5.Location = new System.Drawing.Point(3, 3);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(88, 26);
this.label5.TabIndex = 4;
this.label5.Text = "ItemSize";
//
// stackPanel8
//
this.stackPanel8.Controls.Add(this.select_vertical);
this.stackPanel8.Controls.Add(this.label6);
this.stackPanel8.Location = new System.Drawing.Point(3, 117);
this.stackPanel8.Name = "stackPanel8";
this.stackPanel8.Size = new System.Drawing.Size(274, 32);
this.stackPanel8.TabIndex = 21;
this.stackPanel8.Text = "stackPanel8";
//
// select_vertical
//
this.select_vertical.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.select_vertical.Items.AddRange(new object[] {
"True",
"False"});
this.select_vertical.List = true;
this.select_vertical.Location = new System.Drawing.Point(97, 3);
this.select_vertical.Name = "select_vertical";
this.select_vertical.SelectedIndex = 0;
this.select_vertical.SelectedValue = "True";
this.select_vertical.Size = new System.Drawing.Size(175, 26);
this.select_vertical.TabIndex = 11;
this.select_vertical.Text = "True";
this.select_vertical.WaveSize = 1;
//
// label6
//
this.label6.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label6.Location = new System.Drawing.Point(3, 3);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(88, 26);
this.label6.TabIndex = 4;
this.label6.Text = "Vertical";
//
// buttonCZ
//
this.buttonCZ.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonCZ.Location = new System.Drawing.Point(3, 193);
this.buttonCZ.Name = "buttonCZ";
this.buttonCZ.Size = new System.Drawing.Size(274, 32);
this.buttonCZ.TabIndex = 35;
this.buttonCZ.Text = "重 置";
this.buttonCZ.Type = AntdUI.TTypeMini.Warn;
this.buttonCZ.WaveSize = 0;
//
// buttonSZ
//
this.buttonSZ.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonSZ.Location = new System.Drawing.Point(3, 155);
this.buttonSZ.Name = "buttonSZ";
this.buttonSZ.Size = new System.Drawing.Size(274, 32);
this.buttonSZ.TabIndex = 34;
this.buttonSZ.Text = "设 置";
this.buttonSZ.Type = AntdUI.TTypeMini.Primary;
this.buttonSZ.WaveSize = 0;
//
// buttonDEL
//
this.buttonDEL.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonDEL.Location = new System.Drawing.Point(3, 269);
this.buttonDEL.Name = "buttonDEL";
this.buttonDEL.Size = new System.Drawing.Size(274, 32);
this.buttonDEL.TabIndex = 38;
this.buttonDEL.Text = "删除 Button";
this.buttonDEL.Type = AntdUI.TTypeMini.Error;
this.buttonDEL.WaveSize = 0;
//
// buttonADD
//
this.buttonADD.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonADD.Location = new System.Drawing.Point(3, 231);
this.buttonADD.Name = "buttonADD";
this.buttonADD.Size = new System.Drawing.Size(274, 32);
this.buttonADD.TabIndex = 37;
this.buttonADD.Text = "添加 Button";
this.buttonADD.Type = AntdUI.TTypeMini.Info;
this.buttonADD.WaveSize = 0;
//
// input_itemsize
//
this.input_itemsize.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.input_itemsize.Location = new System.Drawing.Point(97, 3);
this.input_itemsize.Name = "input_itemsize";
this.input_itemsize.PlaceholderText = "数值或百分比";
this.input_itemsize.Size = new System.Drawing.Size(174, 26);
this.input_itemsize.TabIndex = 5;
this.input_itemsize.WaveSize = 0;
//
// StackPanelDemo
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.Controls.Add(this.stackPanel1);
this.Name = "StackPanelDemo";
this.Size = new System.Drawing.Size(700, 531);
this.Load += new System.EventHandler(this.StackPanelDemo_Load);
this.stackPanel1.ResumeLayout(false);
this.stackPanel2.ResumeLayout(false);
this.stackPanel3.ResumeLayout(false);
this.stackPanel6.ResumeLayout(false);
this.stackPanel5.ResumeLayout(false);
this.stackPanel7.ResumeLayout(false);
this.stackPanel8.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private AntdUI.StackPanel stackPanel1;
private AntdUI.Label label2;
private AntdUI.Label label1;
private AntdUI.Divider divider1;
private AntdUI.StackPanel stackPanel2;
private AntdUI.StackPanel stackPanel;
private AntdUI.StackPanel stackPanel3;
private AntdUI.StackPanel stackPanel6;
private AntdUI.Select select_autoscroll;
private AntdUI.Label label4;
private AntdUI.StackPanel stackPanel5;
private AntdUI.InputNumber input_gap;
private AntdUI.Label label3;
private AntdUI.StackPanel stackPanel8;
private AntdUI.Select select_vertical;
private AntdUI.Label label6;
private AntdUI.StackPanel stackPanel7;
private AntdUI.Label label5;
private AntdUI.Button buttonCZ;
private AntdUI.Button buttonSZ;
private AntdUI.Button buttonDEL;
private AntdUI.Button buttonADD;
private AntdUI.Input input_itemsize;
}
}

106
Views/StackPanelDemo.cs Normal file
View File

@ -0,0 +1,106 @@
using AntdUI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AntdUIDemo.Views
{
public partial class StackPanelDemo : UserControl
{
private Window form;
public StackPanelDemo(Window _form)
{
form = _form;
InitializeComponent();
//设置默认值
InitData();
// 绑定按钮事件
BindButtonClick();
}
private void StackPanelDemo_Load(object sender, EventArgs e)
{
LoadStackPanel();
}
private void LoadStackPanel()
{
stackPanel.AutoScroll = select_autoscroll.SelectedIndex == 0;
stackPanel.Gap = (int)input_gap.Value;
stackPanel.ItemSize = input_itemsize.Text;
stackPanel.Vertical = select_vertical.SelectedIndex == 0;
stackPanel.Controls.Clear();
for (int i= 0; i < 3; i++){
var control = new AntdUI.Button()
{
Text = $"Button{i}",
Type = TTypeMini.Primary,
WaveSize = 0,
Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(134))),
};
form.AutoDpi(control);
stackPanel.Controls.Add(control);
}
}
private void BindButtonClick()
{
buttonSZ.Click += ButtonSZ_Click;
buttonCZ.Click += ButtonCZ_Click;
buttonADD.Click += ButtonADD_Click;
buttonDEL.Click += ButtonDEL_Click;
}
private void ButtonDEL_Click(object sender, EventArgs e)
{
if (stackPanel.Controls.Count > 0)
{
// 删除最后一个控件
stackPanel.Controls.RemoveAt(stackPanel.Controls.Count - 1);
}
}
private void ButtonADD_Click(object sender, EventArgs e)
{
var control = new AntdUI.Button()
{
Text = $"Button{stackPanel.Controls.Count}",
Type = TTypeMini.Primary,
WaveSize = 0,
Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(134))),
};
form.AutoDpi(control);
stackPanel.Controls.Add(control);
}
private void ButtonCZ_Click(object sender, EventArgs e)
{
InitData();
LoadStackPanel();
}
private void ButtonSZ_Click(object sender, EventArgs e)
{
stackPanel.AutoScroll = select_autoscroll.SelectedIndex == 0;
stackPanel.Gap = (int)input_gap.Value;
stackPanel.ItemSize = input_itemsize.Text;
stackPanel.Vertical = select_vertical.SelectedIndex == 0;
}
private void InitData()
{
select_autoscroll.SelectedIndex = 1;
input_gap.Value = 0;
input_itemsize.Text = "10%";
select_vertical.SelectedIndex = 0;
}
}
}

120
Views/StackPanelDemo.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 767 KiB

After

Width:  |  Height:  |  Size: 478 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 748 KiB

After

Width:  |  Height:  |  Size: 472 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 710 KiB

After

Width:  |  Height:  |  Size: 323 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 754 KiB

After

Width:  |  Height:  |  Size: 371 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 KiB