diff --git a/TEMUKJD/PDDForms/ProductSelectForms/CloudGoodsForm.cs b/TEMUKJD/PDDForms/ProductSelectForms/CloudGoodsForm.cs
index a24337f..0a3fde8 100644
--- a/TEMUKJD/PDDForms/ProductSelectForms/CloudGoodsForm.cs
+++ b/TEMUKJD/PDDForms/ProductSelectForms/CloudGoodsForm.cs
@@ -55,7 +55,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
num_minprice.Value = 0;
num_maxprice.Value = 999;
cb_Platform.SelectedIndex = 0;
- //ucSplitPage1.TotalPage
+ ucSplitPage1.TotalCount = 0;
}
@@ -251,7 +251,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
}
var parentCategory = ccb.SelectedItem as PddCatInfo;
-
+
// 启用并填充当前级别及上级(如果需要)
for (int i = currentLevel + 1; i < catBoxList.Count; i++)
{
@@ -358,6 +358,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
{
ret.List.ForEach(a => dataList.Add(a));
ucSplitPage1.TotalPage = Math.Max(1, ret.TotalPages);
+ ucSplitPage1.TotalCount = ret.Total;
this.pbLoading.Visible = false;
// 异步加载商品缩略图(Column1 绑定 ThumbUrl)
ShowDgvImg();
diff --git a/TEMUKJD/UserControls/UcSplitPage.Designer.cs b/TEMUKJD/UserControls/UcSplitPage.Designer.cs
index fbbe045..a3b8f90 100644
--- a/TEMUKJD/UserControls/UcSplitPage.Designer.cs
+++ b/TEMUKJD/UserControls/UcSplitPage.Designer.cs
@@ -52,7 +52,7 @@ namespace TemuKJD.UserControls
this.btnPrev.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnPrev.DisabledBackColor = System.Drawing.Color.Empty;
this.btnPrev.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.btnPrev.Location = new System.Drawing.Point(259, 0);
+ this.btnPrev.Location = new System.Drawing.Point(235, 0);
this.btnPrev.Margin = new System.Windows.Forms.Padding(0);
this.btnPrev.Name = "btnPrev";
this.btnPrev.Size = new System.Drawing.Size(31, 20);
@@ -102,11 +102,11 @@ namespace TemuKJD.UserControls
//
this.lblPage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)));
this.lblPage.AutoSize = true;
- this.lblPage.Location = new System.Drawing.Point(293, 0);
+ this.lblPage.Location = new System.Drawing.Point(269, 0);
this.lblPage.Name = "lblPage";
- this.lblPage.Size = new System.Drawing.Size(15, 20);
+ this.lblPage.Size = new System.Drawing.Size(39, 20);
this.lblPage.TabIndex = 436;
- this.lblPage.Text = "1";
+ this.lblPage.Text = "1/1页";
this.lblPage.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// flowLayoutPanel1
@@ -216,19 +216,19 @@ namespace TemuKJD.UserControls
//
this.lblTotal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)));
this.lblTotal.AutoSize = true;
- this.lblTotal.Location = new System.Drawing.Point(220, 0);
+ this.lblTotal.Location = new System.Drawing.Point(196, 0);
this.lblTotal.Margin = new System.Windows.Forms.Padding(0);
this.lblTotal.Name = "lblTotal";
this.lblTotal.Size = new System.Drawing.Size(39, 20);
this.lblTotal.TabIndex = 446;
- this.lblTotal.Text = "共1页";
+ this.lblTotal.Text = "共1条";
this.lblTotal.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lblPageSize
//
this.lblPageSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)));
this.lblPageSize.AutoSize = true;
- this.lblPageSize.Location = new System.Drawing.Point(177, 0);
+ this.lblPageSize.Location = new System.Drawing.Point(153, 0);
this.lblPageSize.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.lblPageSize.Name = "lblPageSize";
this.lblPageSize.Size = new System.Drawing.Size(37, 20);
@@ -250,7 +250,7 @@ namespace TemuKJD.UserControls
"1000",
"2000",
"5000"});
- this.cmbPageSize.Location = new System.Drawing.Point(132, 0);
+ this.cmbPageSize.Location = new System.Drawing.Point(108, 0);
this.cmbPageSize.Margin = new System.Windows.Forms.Padding(0);
this.cmbPageSize.Name = "cmbPageSize";
this.cmbPageSize.RightToLeft = System.Windows.Forms.RightToLeft.No;
@@ -287,5 +287,5 @@ namespace TemuKJD.UserControls
private System.Windows.Forms.Label lblPageSize;
public System.Windows.Forms.ComboBox cmbPageSize;
public System.Windows.Forms.Label lblTotal;
- }
+ }
}
diff --git a/TEMUKJD/UserControls/UcSplitPage.cs b/TEMUKJD/UserControls/UcSplitPage.cs
index 5480970..ce3dcd7 100644
--- a/TEMUKJD/UserControls/UcSplitPage.cs
+++ b/TEMUKJD/UserControls/UcSplitPage.cs
@@ -11,141 +11,173 @@ using System.Windows.Forms;
namespace TemuKJD.UserControls
{
- public partial class UcSplitPage : UserControl
- {
- ///
- /// 是否显示每页条数(启用每页条数功能)
- ///
- [Description("显示每页条数"), Category("UserProperty")]
- public bool IsShowPageSize
- {
- get
- {
- return this.cmbPageSize.Visible;
- }
- set
- {
- if (cmbPageSize.Visible != value)
- {
- this.lblPageSize.Visible = this.cmbPageSize.Visible = value;
- this.Invalidate();
- }
- }
- }
+ public partial class UcSplitPage : UserControl
+ {
+ ///
+ /// 是否显示每页条数(启用每页条数功能)
+ ///
+ [Description("显示每页条数"), Category("UserProperty")]
+ public bool IsShowPageSize
+ {
+ get
+ {
+ return this.cmbPageSize.Visible;
+ }
+ set
+ {
+ if (cmbPageSize.Visible != value)
+ {
+ this.lblPageSize.Visible = this.cmbPageSize.Visible = value;
+ this.Invalidate();
+ }
+ }
+ }
+ long totalCount = 0;
+ ///
+ /// 总数量
+ ///
+ [Description("总数量"), Category("UserProperty")]
+ public long TotalCount
+ {
+ get { return totalCount; }
+ set
+ {
+ if (totalCount != value && value >= 0)
+ {
+ totalCount = value;
+ // 根据总数量和每页条数计算总页数
+ int pageSize = this.PageSize;
+ if (pageSize > 0)
+ {
+ this.TotalPage = (int)Math.Ceiling((double)totalCount / pageSize);
+ }
+ else
+ {
+ this.TotalPage = 1;
+ }
+ Refresh();
+ }
+ }
+ }
- int totalPage = 1;
- public int TotalPage
- {
- get { return totalPage; }
- set
- {
- if (TotalPage != value && value > 0)
- {
- totalPage = value;
- if (InvokeRequired)
- {
- Invoke(new Action(() =>
- {
- this.lblTotal.Text = "共 " + totalPage + " 页";
- }));
- }
- else
- this.lblTotal.Text = "共 " + totalPage + " 页";
- }
- }
- }
+ int totalPage = 1;
+ public int TotalPage
+ {
+ get { return totalPage; }
+ set
+ {
+ if (totalPage != value && value > 0)
+ {
+ totalPage = value;
+ Refresh();
+ }
+ }
+ }
- int currentPage = 1;
- public int CurrentPage
- {
- get { return currentPage; }
- set
- {
- if (currentPage != value)
- {
- currentPage = value;
- if (InvokeRequired)
- {
- Invoke(new Action(() =>
- {
- this.lblPage.Text = "" + currentPage;
- }));
- }
- else
- this.lblPage.Text = "" + currentPage;
- }
- OnPageChange(this);
- }
- }
+ int currentPage = 1;
+ public int CurrentPage
+ {
+ get { return currentPage; }
+ set
+ {
+ // 确保当前页不超过总页数
+ int newPage = Math.Max(1, Math.Min(totalPage, value));
+ if (currentPage != newPage)
+ {
+ currentPage = newPage;
+ Refresh();
+ }
+ OnPageChange(this);
+ }
+ }
- [Description("每页条数"), Category("UserProperty")]
- public int PageSize
- {
- get
- {
- int pageSize = 50;
- if (InvokeRequired)
- {
- Invoke(new Action(() =>
- {
- pageSize = Math.Max(this.cmbPageSize.Text.ParseToInt(), 1);
- }));
- }
- else
- pageSize = Math.Max(this.cmbPageSize.Text.ParseToInt(), 1);
- return pageSize;
- }
- set
- {
- if (InvokeRequired)
- {
- Invoke(new Action(() =>
- {
- if (this.cmbPageSize.Text.ParseToInt() != value)
- this.cmbPageSize.Text = value.ParseToString();
- else
- this.cmbPageSize.Text = value.ParseToString();
- }));
- }
- else
- {
- if (this.cmbPageSize.Text.ParseToInt() != value)
- this.cmbPageSize.Text = value.ParseToString();
- else
- this.cmbPageSize.Text = value.ParseToString();
- }
- //OnPageChange(this);
- }
- }
+ [Description("每页条数"), Category("UserProperty")]
+ public int PageSize
+ {
+ get
+ {
+ int pageSize = 50;
+ if (InvokeRequired)
+ {
+ Invoke(new Action(() =>
+ {
+ pageSize = Math.Max(this.cmbPageSize.Text.ParseToInt(), 1);
+ }));
+ }
+ else
+ pageSize = Math.Max(this.cmbPageSize.Text.ParseToInt(), 1);
+ return pageSize;
+ }
+ set
+ {
+ if (InvokeRequired)
+ {
+ Invoke(new Action(() =>
+ {
+ if (this.cmbPageSize.Text.ParseToInt() != value)
+ this.cmbPageSize.Text = value.ParseToString();
+ else
+ this.cmbPageSize.Text = value.ParseToString();
+ }));
+ }
+ else
+ {
+ if (this.cmbPageSize.Text.ParseToInt() != value)
+ this.cmbPageSize.Text = value.ParseToString();
+ else
+ this.cmbPageSize.Text = value.ParseToString();
+ }
+ // 当每页条数变化时,重新计算总页数
+ if (totalCount > 0)
+ {
+ this.TotalPage = (int)Math.Ceiling((double)totalCount / value);
+ // 确保当前页不超过新的总页数
+ if (this.CurrentPage > this.TotalPage)
+ {
+ this.CurrentPage = this.TotalPage;
+ }
+ }
+ //OnPageChange(this);
+ }
+ }
- public event Action