Panel优化

This commit is contained in:
czz_y 2024-08-16 15:53:14 +08:00
parent 40218c2746
commit 92aab1ab5f
4 changed files with 55 additions and 41 deletions

View File

@ -760,8 +760,7 @@
//
// ButtonDemo
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.stackPanel1);
this.Name = "ButtonDemo";
this.Size = new System.Drawing.Size(724, 629);

View File

@ -110,9 +110,9 @@
//
// colorPicker
//
this.colorPicker.Location = new System.Drawing.Point(469, 3);
this.colorPicker.Location = new System.Drawing.Point(489, 3);
this.colorPicker.Name = "colorPicker";
this.colorPicker.Size = new System.Drawing.Size(80, 26);
this.colorPicker.Size = new System.Drawing.Size(90, 26);
this.colorPicker.TabIndex = 15;
this.colorPicker.Text = "colorPicker1";
this.colorPicker.Value = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(119)))), ((int)(((byte)(255)))));
@ -121,7 +121,7 @@
// label16
//
this.label16.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label16.Location = new System.Drawing.Point(371, 3);
this.label16.Location = new System.Drawing.Point(391, 3);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(92, 26);
this.label16.TabIndex = 14;
@ -129,9 +129,10 @@
//
// input_badgesize
//
this.input_badgesize.Location = new System.Drawing.Point(285, 3);
this.input_badgesize.DecimalPlaces = 2;
this.input_badgesize.Location = new System.Drawing.Point(295, 3);
this.input_badgesize.Name = "input_badgesize";
this.input_badgesize.Size = new System.Drawing.Size(80, 26);
this.input_badgesize.Size = new System.Drawing.Size(90, 26);
this.input_badgesize.TabIndex = 13;
this.input_badgesize.Text = "6";
this.input_badgesize.Value = new decimal(new int[] {
@ -144,7 +145,7 @@
// label15
//
this.label15.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label15.Location = new System.Drawing.Point(187, 3);
this.label15.Location = new System.Drawing.Point(197, 3);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(92, 26);
this.label15.TabIndex = 12;
@ -154,7 +155,7 @@
//
this.input_badge.Location = new System.Drawing.Point(101, 3);
this.input_badge.Name = "input_badge";
this.input_badge.Size = new System.Drawing.Size(80, 26);
this.input_badge.Size = new System.Drawing.Size(90, 26);
this.input_badge.TabIndex = 5;
this.input_badge.WaveSize = 1;
//
@ -183,9 +184,9 @@
//
// input_radius
//
this.input_radius.Location = new System.Drawing.Point(469, 3);
this.input_radius.Location = new System.Drawing.Point(489, 3);
this.input_radius.Name = "input_radius";
this.input_radius.Size = new System.Drawing.Size(80, 26);
this.input_radius.Size = new System.Drawing.Size(90, 26);
this.input_radius.TabIndex = 11;
this.input_radius.Text = "6";
this.input_radius.Value = new decimal(new int[] {
@ -198,7 +199,7 @@
// label12
//
this.label12.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label12.Location = new System.Drawing.Point(371, 3);
this.label12.Location = new System.Drawing.Point(391, 3);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(92, 26);
this.label12.TabIndex = 10;
@ -208,16 +209,16 @@
//
this.select_type.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.select_type.List = true;
this.select_type.Location = new System.Drawing.Point(285, 3);
this.select_type.Location = new System.Drawing.Point(295, 3);
this.select_type.Name = "select_type";
this.select_type.Size = new System.Drawing.Size(80, 26);
this.select_type.Size = new System.Drawing.Size(90, 26);
this.select_type.TabIndex = 9;
this.select_type.WaveSize = 1;
//
// label13
//
this.label13.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label13.Location = new System.Drawing.Point(187, 3);
this.label13.Location = new System.Drawing.Point(197, 3);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(92, 26);
this.label13.TabIndex = 8;
@ -229,7 +230,7 @@
this.select_shape.List = true;
this.select_shape.Location = new System.Drawing.Point(101, 3);
this.select_shape.Name = "select_shape";
this.select_shape.Size = new System.Drawing.Size(80, 26);
this.select_shape.Size = new System.Drawing.Size(90, 26);
this.select_shape.TabIndex = 5;
this.select_shape.WaveSize = 1;
//
@ -267,9 +268,9 @@
//
// input_my
//
this.input_my.Location = new System.Drawing.Point(469, 3);
this.input_my.Location = new System.Drawing.Point(489, 3);
this.input_my.Name = "input_my";
this.input_my.Size = new System.Drawing.Size(80, 26);
this.input_my.Size = new System.Drawing.Size(90, 26);
this.input_my.TabIndex = 9;
this.input_my.Text = "24";
this.input_my.Value = new decimal(new int[] {
@ -282,7 +283,7 @@
// label8
//
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(371, 3);
this.label8.Location = new System.Drawing.Point(391, 3);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(92, 26);
this.label8.TabIndex = 8;
@ -290,9 +291,9 @@
//
// input_mx
//
this.input_mx.Location = new System.Drawing.Point(285, 3);
this.input_mx.Location = new System.Drawing.Point(295, 3);
this.input_mx.Name = "input_mx";
this.input_mx.Size = new System.Drawing.Size(80, 26);
this.input_mx.Size = new System.Drawing.Size(90, 26);
this.input_mx.TabIndex = 7;
this.input_mx.Text = "24";
this.input_mx.Value = new decimal(new int[] {
@ -305,7 +306,7 @@
// label7
//
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(187, 3);
this.label7.Location = new System.Drawing.Point(197, 3);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(92, 26);
this.label7.TabIndex = 6;
@ -315,7 +316,7 @@
//
this.input_size.Location = new System.Drawing.Point(101, 3);
this.input_size.Name = "input_size";
this.input_size.Size = new System.Drawing.Size(80, 26);
this.input_size.Size = new System.Drawing.Size(90, 26);
this.input_size.TabIndex = 5;
this.input_size.Text = "40";
this.input_size.Value = new decimal(new int[] {
@ -355,10 +356,10 @@
"True",
"Flase"});
this.select_vertical.List = true;
this.select_vertical.Location = new System.Drawing.Point(469, 3);
this.select_vertical.Location = new System.Drawing.Point(489, 3);
this.select_vertical.Name = "select_vertical";
this.select_vertical.SelectedValue = "是";
this.select_vertical.Size = new System.Drawing.Size(80, 26);
this.select_vertical.Size = new System.Drawing.Size(90, 26);
this.select_vertical.TabIndex = 11;
this.select_vertical.Text = "True";
this.select_vertical.WaveSize = 1;
@ -366,7 +367,7 @@
// 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(371, 3);
this.label5.Location = new System.Drawing.Point(391, 3);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(92, 26);
this.label5.TabIndex = 10;
@ -379,10 +380,10 @@
"True",
"Flase"});
this.select_topmost.List = true;
this.select_topmost.Location = new System.Drawing.Point(285, 3);
this.select_topmost.Location = new System.Drawing.Point(295, 3);
this.select_topmost.Name = "select_topmost";
this.select_topmost.SelectedValue = "是";
this.select_topmost.Size = new System.Drawing.Size(80, 26);
this.select_topmost.Size = new System.Drawing.Size(90, 26);
this.select_topmost.TabIndex = 9;
this.select_topmost.Text = "True";
this.select_topmost.WaveSize = 1;
@ -390,7 +391,7 @@
// 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(187, 3);
this.label6.Location = new System.Drawing.Point(197, 3);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(92, 26);
this.label6.TabIndex = 8;
@ -402,7 +403,7 @@
this.select_align.List = true;
this.select_align.Location = new System.Drawing.Point(101, 3);
this.select_align.Name = "select_align";
this.select_align.Size = new System.Drawing.Size(80, 26);
this.select_align.Size = new System.Drawing.Size(90, 26);
this.select_align.TabIndex = 5;
this.select_align.WaveSize = 1;
//

View File

@ -27,6 +27,7 @@ namespace AntdUIDemo.Views
LoadBaseFloatButton();
}
// 初始化下拉框
private void InitSelectItems()
{
//初始化方向
@ -49,6 +50,7 @@ namespace AntdUIDemo.Views
}
}
// 设置默认值
private void SetDefaultSelectItem()
{
select_align.SelectedIndex = 7;
@ -64,17 +66,17 @@ namespace AntdUIDemo.Views
input_badge.Text = "";
input_badgesize.Value = 6;
colorPicker.Value = Color.FromArgb(22, 119, 255);
}
// 加载浮动按钮
private void LoadBaseFloatButton()
{
if (floatButtonForm == null || floatButtonForm.IsDisposed)
{
floatButtonForm = AntdUI.FloatButton.open(new AntdUI.FloatButton.Config(form, new AntdUI.FloatButton.ConfigBtn[]
floatButtonForm = FloatButton.open(new FloatButton.Config(form, new FloatButton.ConfigBtn[]
{
// 使用 svg 图片
new AntdUI.FloatButton.ConfigBtn("按钮1","",true)
new FloatButton.ConfigBtn("按钮1","",true)
{
Tooltip = "SVG图片按钮",
IconSvg = "<svg t=\"1723689594681\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"3131\" width=\"200\" height=\"200\"><path d=\"M527.034926 942.620551c-247.174496 0-447.543989-200.370517-447.543989-447.538873 0-190.783161 119.585609-353.238137 287.701514-417.622516l0 69.242014c-131.960451 60.646242-223.765343 193.624882-223.765343 348.381525 0 211.845872 171.759899 383.606795 383.606795 383.606795 211.845872 0 383.605771-171.762969 383.605771-383.606795 0-154.75562-91.811032-287.736307-223.771483-348.411201L686.868191 77.459163c168.113859 64.384379 287.702538 226.840378 287.702538 417.622516C974.573799 742.250034 774.203282 942.620551 527.034926 942.620551L527.034926 942.620551zM495.066841 47.538713l63.931055 0L558.997895 496.231875l-63.931055 0L495.066841 47.538713 495.066841 47.538713z\" fill=\"#272636\" p-id=\"3132\"></path></svg>",
@ -82,29 +84,29 @@ namespace AntdUIDemo.Views
Type = (TTypeMini)select_type.SelectedValue,
Radius = Convert.ToInt32(input_radius.Value),
Badge = input_badge.Text,
BadgeSize = Convert.ToInt32(input_badgesize.Value),
BadgeSize = (float)input_badgesize.Value,
BadgeBack = colorPicker.Value,
},
// 使用资源图片
new AntdUI.FloatButton.ConfigBtn("按钮2", Properties.Resources.)
new FloatButton.ConfigBtn("按钮2", Properties.Resources.)
{
Tooltip = "资源图片按钮",
Shape = select_shape.SelectedIndex == 0 ? TShape.Default :(select_shape.SelectedIndex == 1 ? TShape.Round : TShape.Circle),
Type = (TTypeMini)select_type.SelectedValue,
Radius = Convert.ToInt32(input_radius.Value),
Badge = input_badge.Text,
BadgeSize = Convert.ToInt32(input_badgesize.Value),
BadgeSize = (float)input_badgesize.Value,
BadgeBack = colorPicker.Value,
},
// 使用文本
new AntdUI.FloatButton.ConfigBtn("按钮3", "关闭")
new FloatButton.ConfigBtn("按钮3", "关闭")
{
Tooltip = "文本按钮",
Shape = select_shape.SelectedIndex == 0 ? TShape.Default :(select_shape.SelectedIndex == 1 ? TShape.Round : TShape.Circle),
Type = (TTypeMini)select_type.SelectedValue,
Radius = Convert.ToInt32(input_radius.Value),
Badge = input_badge.Text,
BadgeSize = Convert.ToInt32(input_badgesize.Value),
BadgeSize = (float)input_badgesize.Value,
BadgeBack = colorPicker.Value,
},
@ -114,13 +116,13 @@ namespace AntdUIDemo.Views
})
{
// 配置
Font = new Font("Microsoft JhengHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point),
Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point),
Control = null,
Align = (TAlign)select_align.SelectedIndex,
Vertical = select_vertical.SelectedIndex == 0,
TopMost = select_topmost.SelectedIndex == 0,
Size =Convert.ToInt32(input_size.Value),
MarginX = Convert.ToInt32(input_mx.Value),
Size = Convert.ToInt32(input_size.Value),
MarginX = Convert.ToInt32(input_mx.Value),
MarginY = Convert.ToInt32(input_my.Value),
});
}
@ -137,17 +139,22 @@ namespace AntdUIDemo.Views
}
}
// 重置
private void buttonCZ_Click(object sender, EventArgs e)
{
SetDefaultSelectItem();
CloseFloatButtonForm();
LoadBaseFloatButton();
}
// 设置
private void buttonOpen_Click(object sender, EventArgs e)
{
CloseFloatButtonForm();
LoadBaseFloatButton();
}
// 关闭
private void buttonClose_Click(object sender, EventArgs e)
{
CloseFloatButtonForm();

View File

@ -58,10 +58,17 @@ namespace AntdUIDemo.Views
input_shadowY.Value = 0;
input_shadowO.Value = (decimal)0.2;
input_shadowOH.Value = (decimal)0.3;
LoadPanel();
}
// 设置
private void buttonSZ_Click(object sender, EventArgs e)
{
LoadPanel();
}
private void LoadPanel()
{
panel.ArrowAlign = (TAlign)select_arrowalign.SelectedValue;
panel.ArrowSize = (int)input_arrowsize.Value;