* UIMiniPagination: 内置按钮关联值由Tag改为TagString
* UIPagination: 内置按钮关联值由Tag改为TagString
This commit is contained in:
parent
6ed6ec9afa
commit
9679e2e9c2
@ -18,6 +18,7 @@
|
|||||||
*
|
*
|
||||||
* 2023-02-19: V3.3.2 新增迷你分页控件,只有分页按钮,无其他
|
* 2023-02-19: V3.3.2 新增迷你分页控件,只有分页按钮,无其他
|
||||||
* 2023-06-14: V3.3.9 按钮图标位置修正
|
* 2023-06-14: V3.3.9 按钮图标位置修正
|
||||||
|
* 2023-06-27: V3.3.9 内置按钮关联值由Tag改为TagString
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -54,8 +55,8 @@ namespace Sunny.UI
|
|||||||
private UISymbolButton b8;
|
private UISymbolButton b8;
|
||||||
private UISymbolButton b9;
|
private UISymbolButton b9;
|
||||||
|
|
||||||
private readonly ConcurrentDictionary<int, UISymbolButton> buttons =
|
private readonly ConcurrentDictionary<int, UISymbolButton> buttons = new ConcurrentDictionary<int, UISymbolButton>();
|
||||||
new ConcurrentDictionary<int, UISymbolButton>();
|
private readonly ConcurrentDictionary<UISymbolButton, int> buttonTags = new ConcurrentDictionary<UISymbolButton, int>();
|
||||||
private CurrencyManager dataManager;
|
private CurrencyManager dataManager;
|
||||||
|
|
||||||
private object dataSource;
|
private object dataSource;
|
||||||
@ -108,6 +109,15 @@ namespace Sunny.UI
|
|||||||
buttons[i].Size = new System.Drawing.Size(32, 32);
|
buttons[i].Size = new System.Drawing.Size(32, 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buttonTags.TryAdd(b0, -1);
|
||||||
|
buttonTags.TryAdd(b16, 1);
|
||||||
|
for (var i = 0; i < 17; i++)
|
||||||
|
{
|
||||||
|
if (buttonTags.NotContainsKey(buttons[i]))
|
||||||
|
buttonTags.TryAdd(buttons[i], 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TotalCount = 1000;
|
TotalCount = 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,9 +301,9 @@ namespace Sunny.UI
|
|||||||
var btn = (UISymbolButton)sender;
|
var btn = (UISymbolButton)sender;
|
||||||
btn.BringToFront();
|
btn.BringToFront();
|
||||||
if (btn.TagString.IsValid())
|
if (btn.TagString.IsValid())
|
||||||
ActivePage += btn.Tag.ToString().ToInt();
|
ActivePage += buttonTags[btn];
|
||||||
else
|
else
|
||||||
ActivePage = btn.Tag.ToString().ToInt();
|
ActivePage = buttonTags[btn];
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UIDataGridPage_MouseLeave(object sender, EventArgs e)
|
private void UIDataGridPage_MouseLeave(object sender, EventArgs e)
|
||||||
@ -358,7 +368,6 @@ namespace Sunny.UI
|
|||||||
this.b0.Size = new System.Drawing.Size(32, 32);
|
this.b0.Size = new System.Drawing.Size(32, 32);
|
||||||
this.b0.Symbol = 61700;
|
this.b0.Symbol = 61700;
|
||||||
this.b0.TabIndex = 0;
|
this.b0.TabIndex = 0;
|
||||||
this.b0.Tag = "-1";
|
|
||||||
this.b0.TagString = "<";
|
this.b0.TagString = "<";
|
||||||
this.b0.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
this.b0.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||||
this.b0.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
|
this.b0.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
|
||||||
@ -586,7 +595,6 @@ namespace Sunny.UI
|
|||||||
this.b16.Size = new System.Drawing.Size(32, 32);
|
this.b16.Size = new System.Drawing.Size(32, 32);
|
||||||
this.b16.Symbol = 61701;
|
this.b16.Symbol = 61701;
|
||||||
this.b16.TabIndex = 16;
|
this.b16.TabIndex = 16;
|
||||||
this.b16.Tag = "1";
|
|
||||||
this.b16.TagString = ">";
|
this.b16.TagString = ">";
|
||||||
this.b16.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
this.b16.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||||
this.b16.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
|
this.b16.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
|
||||||
@ -624,7 +632,7 @@ namespace Sunny.UI
|
|||||||
private void SetShowButton(int buttonIdx, int pageIdx, int activeIdx)
|
private void SetShowButton(int buttonIdx, int pageIdx, int activeIdx)
|
||||||
{
|
{
|
||||||
buttons[buttonIdx].Symbol = 0;
|
buttons[buttonIdx].Symbol = 0;
|
||||||
buttons[buttonIdx].Tag = pageIdx;
|
buttonTags[buttons[buttonIdx]] = pageIdx;
|
||||||
buttons[buttonIdx].Visible = true;
|
buttons[buttonIdx].Visible = true;
|
||||||
buttons[buttonIdx].TagString = "";
|
buttons[buttonIdx].TagString = "";
|
||||||
buttons[buttonIdx].Selected = activeIdx == pageIdx;
|
buttons[buttonIdx].Selected = activeIdx == pageIdx;
|
||||||
@ -637,7 +645,7 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
buttons[buttonIdx].Symbol = 0;
|
buttons[buttonIdx].Symbol = 0;
|
||||||
buttons[buttonIdx].Text = @"···";
|
buttons[buttonIdx].Text = @"···";
|
||||||
buttons[buttonIdx].Tag = addCount;
|
buttonTags[buttons[buttonIdx]] = addCount;
|
||||||
buttons[buttonIdx].Visible = true;
|
buttons[buttonIdx].Visible = true;
|
||||||
buttons[buttonIdx].TagString = tagString;
|
buttons[buttonIdx].TagString = tagString;
|
||||||
buttons[buttonIdx].Selected = false;
|
buttons[buttonIdx].Selected = false;
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
* 2020-07-15: V2.2.6 新增分页控件
|
* 2020-07-15: V2.2.6 新增分页控件
|
||||||
* 2021-03-27: V3.0.2 修正因两次查询数量相等而引起的不刷新
|
* 2021-03-27: V3.0.2 修正因两次查询数量相等而引起的不刷新
|
||||||
* 2021-07-10: V3.0.4 设置总数在页面不超过总页数的情况下不刷新
|
* 2021-07-10: V3.0.4 设置总数在页面不超过总页数的情况下不刷新
|
||||||
|
* 2023-06-27: V3.3.9 内置按钮关联值由Tag改为TagString
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -56,8 +57,8 @@ namespace Sunny.UI
|
|||||||
private UISymbolButton b9;
|
private UISymbolButton b9;
|
||||||
private UISymbolButton btnSelect;
|
private UISymbolButton btnSelect;
|
||||||
|
|
||||||
private readonly ConcurrentDictionary<int, UISymbolButton> buttons =
|
private readonly ConcurrentDictionary<int, UISymbolButton> buttons = new ConcurrentDictionary<int, UISymbolButton>();
|
||||||
new ConcurrentDictionary<int, UISymbolButton>();
|
private readonly ConcurrentDictionary<UISymbolButton, int> buttonTags = new ConcurrentDictionary<UISymbolButton, int>();
|
||||||
private CurrencyManager dataManager;
|
private CurrencyManager dataManager;
|
||||||
|
|
||||||
private object dataSource;
|
private object dataSource;
|
||||||
@ -115,6 +116,14 @@ namespace Sunny.UI
|
|||||||
buttons[i].Click += UIDataGridPage_Click;
|
buttons[i].Click += UIDataGridPage_Click;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buttonTags.TryAdd(b0, -1);
|
||||||
|
buttonTags.TryAdd(b16, 1);
|
||||||
|
for (var i = 0; i < 17; i++)
|
||||||
|
{
|
||||||
|
if (buttonTags.NotContainsKey(buttons[i]))
|
||||||
|
buttonTags.TryAdd(buttons[i], 0);
|
||||||
|
}
|
||||||
|
|
||||||
Translate();
|
Translate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,9 +340,9 @@ namespace Sunny.UI
|
|||||||
var btn = (UISymbolButton)sender;
|
var btn = (UISymbolButton)sender;
|
||||||
btn.BringToFront();
|
btn.BringToFront();
|
||||||
if (btn.TagString.IsValid())
|
if (btn.TagString.IsValid())
|
||||||
ActivePage += btn.Tag.ToString().ToInt();
|
ActivePage += buttonTags[btn];
|
||||||
else
|
else
|
||||||
ActivePage = btn.Tag.ToString().ToInt();
|
ActivePage = buttonTags[btn];
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UIDataGridPage_MouseLeave(object sender, EventArgs e)
|
private void UIDataGridPage_MouseLeave(object sender, EventArgs e)
|
||||||
@ -404,7 +413,6 @@ namespace Sunny.UI
|
|||||||
this.b0.Size = new System.Drawing.Size(75, 29);
|
this.b0.Size = new System.Drawing.Size(75, 29);
|
||||||
this.b0.Symbol = 61700;
|
this.b0.Symbol = 61700;
|
||||||
this.b0.TabIndex = 0;
|
this.b0.TabIndex = 0;
|
||||||
this.b0.Tag = "-1";
|
|
||||||
this.b0.TagString = "<";
|
this.b0.TagString = "<";
|
||||||
this.b0.Text = "上一页";
|
this.b0.Text = "上一页";
|
||||||
this.b0.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
this.b0.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||||
@ -649,7 +657,6 @@ namespace Sunny.UI
|
|||||||
this.b16.Size = new System.Drawing.Size(75, 29);
|
this.b16.Size = new System.Drawing.Size(75, 29);
|
||||||
this.b16.Symbol = 61701;
|
this.b16.Symbol = 61701;
|
||||||
this.b16.TabIndex = 16;
|
this.b16.TabIndex = 16;
|
||||||
this.b16.Tag = "1";
|
|
||||||
this.b16.TagString = ">";
|
this.b16.TagString = ">";
|
||||||
this.b16.Text = "下一页";
|
this.b16.Text = "下一页";
|
||||||
this.b16.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
this.b16.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||||
@ -772,7 +779,7 @@ namespace Sunny.UI
|
|||||||
private void SetShowButton(int buttonIdx, int pageIdx, int activeIdx)
|
private void SetShowButton(int buttonIdx, int pageIdx, int activeIdx)
|
||||||
{
|
{
|
||||||
buttons[buttonIdx].Symbol = 0;
|
buttons[buttonIdx].Symbol = 0;
|
||||||
buttons[buttonIdx].Tag = pageIdx;
|
buttonTags[buttons[buttonIdx]] = pageIdx;
|
||||||
buttons[buttonIdx].Visible = true;
|
buttons[buttonIdx].Visible = true;
|
||||||
buttons[buttonIdx].TagString = "";
|
buttons[buttonIdx].TagString = "";
|
||||||
buttons[buttonIdx].Selected = activeIdx == pageIdx;
|
buttons[buttonIdx].Selected = activeIdx == pageIdx;
|
||||||
@ -785,7 +792,7 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
buttons[buttonIdx].Symbol = 0;
|
buttons[buttonIdx].Symbol = 0;
|
||||||
buttons[buttonIdx].Text = @"···";
|
buttons[buttonIdx].Text = @"···";
|
||||||
buttons[buttonIdx].Tag = addCount;
|
buttonTags[buttons[buttonIdx]] = addCount;
|
||||||
buttons[buttonIdx].Visible = true;
|
buttons[buttonIdx].Visible = true;
|
||||||
buttons[buttonIdx].TagString = tagString;
|
buttons[buttonIdx].TagString = tagString;
|
||||||
buttons[buttonIdx].Selected = false;
|
buttons[buttonIdx].Selected = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user