Commit b861ad78 HZH

修改分页控件bug

1 个父辈 fac77462
...@@ -75,15 +75,15 @@ ...@@ -75,15 +75,15 @@
this.panRow.Dock = System.Windows.Forms.DockStyle.Fill; this.panRow.Dock = System.Windows.Forms.DockStyle.Fill;
this.panRow.Location = new System.Drawing.Point(0, 40); this.panRow.Location = new System.Drawing.Point(0, 40);
this.panRow.Name = "panRow"; this.panRow.Name = "panRow";
this.panRow.Size = new System.Drawing.Size(1061, 475); this.panRow.Size = new System.Drawing.Size(1061, 481);
this.panRow.TabIndex = 1; this.panRow.TabIndex = 1;
// //
// panPage // panPage
// //
this.panPage.Dock = System.Windows.Forms.DockStyle.Bottom; this.panPage.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panPage.Location = new System.Drawing.Point(0, 515); this.panPage.Location = new System.Drawing.Point(0, 521);
this.panPage.Name = "panPage"; this.panPage.Name = "panPage";
this.panPage.Size = new System.Drawing.Size(1061, 50); this.panPage.Size = new System.Drawing.Size(1061, 44);
this.panPage.TabIndex = 0; this.panPage.TabIndex = 0;
this.panPage.Visible = false; this.panPage.Visible = false;
// //
......
namespace HZH_Controls.Controls.List namespace HZH_Controls.Controls
{ {
partial class UCPagerControl2 partial class UCPagerControl2
{ {
......
...@@ -12,7 +12,7 @@ using System.Linq; ...@@ -12,7 +12,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace HZH_Controls.Controls.List namespace HZH_Controls.Controls
{ {
[ToolboxItem(true)] [ToolboxItem(true)]
public partial class UCPagerControl2 : UCPagerControlBase public partial class UCPagerControl2 : UCPagerControlBase
...@@ -34,31 +34,31 @@ namespace HZH_Controls.Controls.List ...@@ -34,31 +34,31 @@ namespace HZH_Controls.Controls.List
public override event PageControlEventHandler ShowSourceChanged; public override event PageControlEventHandler ShowSourceChanged;
private List<object> m_dataSource;
public override List<object> DataSource public override List<object> DataSource
{ {
get get
{ {
return m_dataSource; return base.DataSource;
} }
set set
{ {
m_dataSource = value; base.DataSource = value;
if (m_dataSource == null) if (base.DataSource == null)
m_dataSource = new List<object>(); base.DataSource = new List<object>();
ResetPageCount(); ResetPageCount();
} }
} }
private int m_intPageSize = 0;
public override int PageSize public override int PageSize
{ {
get get
{ {
return m_intPageSize; return base.PageSize;
} }
set set
{ {
m_intPageSize = value; base.PageSize = value;
ResetPageCount(); ResetPageCount();
} }
} }
...@@ -128,7 +128,7 @@ namespace HZH_Controls.Controls.List ...@@ -128,7 +128,7 @@ namespace HZH_Controls.Controls.List
{ {
if (PageSize > 0) if (PageSize > 0)
{ {
PageCount = m_dataSource.Count / m_intPageSize + (m_dataSource.Count % m_intPageSize > 0 ? 1 : 0); PageCount = base.DataSource.Count / base.PageSize + (base.DataSource.Count % base.PageSize > 0 ? 1 : 0);
} }
txtPage.MaxValue = PageCount; txtPage.MaxValue = PageCount;
txtPage.MinValue = 1; txtPage.MinValue = 1;
......
...@@ -72,6 +72,9 @@ namespace HZH_Controls.Forms ...@@ -72,6 +72,9 @@ namespace HZH_Controls.Forms
} }
#endregion #endregion
/// <summary>
/// 重置倒计时
/// </summary>
public void ResetTimer() public void ResetTimer()
{ {
if (m_CloseTime > 0) if (m_CloseTime > 0)
......
...@@ -40,14 +40,6 @@ namespace HZH_Controls.Forms ...@@ -40,14 +40,6 @@ namespace HZH_Controls.Forms
private void FrmWithOKCancel1_VisibleChanged(object sender, EventArgs e) private void FrmWithOKCancel1_VisibleChanged(object sender, EventArgs e)
{ {
//if (this.Visible)
//{
// ControlHelper.AnimateWindow(this.Handle, 100, ControlHelper.AW_CENTER);
//}
//else
//{
// ControlHelper.AnimateWindow(this.Handle, 100, ControlHelper.AW_CENTER | ControlHelper.AW_HIDE);
//}
} }
} }
} }
...@@ -40,14 +40,6 @@ namespace HZH_Controls.Forms ...@@ -40,14 +40,6 @@ namespace HZH_Controls.Forms
private void FrmWithOKCancel2_VisibleChanged(object sender, EventArgs e) private void FrmWithOKCancel2_VisibleChanged(object sender, EventArgs e)
{ {
//if (this.Visible)
//{
// ControlHelper.AnimateWindow(this.Handle, 100, ControlHelper.AW_CENTER);
//}
//else
//{
// ControlHelper.AnimateWindow(this.Handle, 100, ControlHelper.AW_CENTER | ControlHelper.AW_HIDE);
//}
} }
} }
} }
...@@ -75,14 +75,6 @@ namespace HZH_Controls.Forms ...@@ -75,14 +75,6 @@ namespace HZH_Controls.Forms
private void FrmWithTitle_VisibleChanged(object sender, EventArgs e) private void FrmWithTitle_VisibleChanged(object sender, EventArgs e)
{ {
//if (this.Visible)
//{
// ControlHelper.AnimateWindow(this.Handle, 100, ControlHelper.AW_CENTER);
//}
//else
//{
// ControlHelper.AnimateWindow(this.Handle, 100, ControlHelper.AW_CENTER | ControlHelper.AW_HIDE);
//}
} }
} }
} }
...@@ -274,11 +274,11 @@ ...@@ -274,11 +274,11 @@
<Compile Include="Forms\FrmInputs.Designer.cs"> <Compile Include="Forms\FrmInputs.Designer.cs">
<DependentUpon>FrmInputs.cs</DependentUpon> <DependentUpon>FrmInputs.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Forms\FrmTemp1.cs"> <Compile Include="Forms\FrmBack.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="Forms\FrmTemp1.Designer.cs"> <Compile Include="Forms\FrmBack.Designer.cs">
<DependentUpon>FrmTemp1.cs</DependentUpon> <DependentUpon>FrmBack.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Forms\FrmTips.cs"> <Compile Include="Forms\FrmTips.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
...@@ -432,8 +432,8 @@ ...@@ -432,8 +432,8 @@
<EmbeddedResource Include="Forms\FrmInputs.resx"> <EmbeddedResource Include="Forms\FrmInputs.resx">
<DependentUpon>FrmInputs.cs</DependentUpon> <DependentUpon>FrmInputs.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Forms\FrmTemp1.resx"> <EmbeddedResource Include="Forms\FrmBack.resx">
<DependentUpon>FrmTemp1.cs</DependentUpon> <DependentUpon>FrmBack.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Forms\FrmTips.resx"> <EmbeddedResource Include="Forms\FrmTips.resx">
<DependentUpon>FrmTips.cs</DependentUpon> <DependentUpon>FrmTips.cs</DependentUpon>
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
this.groupBox10 = new System.Windows.Forms.GroupBox(); this.groupBox10 = new System.Windows.Forms.GroupBox();
this.ucMenu1 = new HZH_Controls.Controls.UCMenu(); this.ucMenu1 = new HZH_Controls.Controls.UCMenu();
this.groupBox11 = new System.Windows.Forms.GroupBox(); this.groupBox11 = new System.Windows.Forms.GroupBox();
this.ucPagerControl21 = new HZH_Controls.Controls.List.UCPagerControl2(); this.ucPagerControl21 = new HZH_Controls.Controls.UCPagerControl2();
this.groupBox12 = new System.Windows.Forms.GroupBox(); this.groupBox12 = new System.Windows.Forms.GroupBox();
this.ucBtnsGroup1 = new HZH_Controls.Controls.UCBtnsGroup(); this.ucBtnsGroup1 = new HZH_Controls.Controls.UCBtnsGroup();
this.groupBox13 = new System.Windows.Forms.GroupBox(); this.groupBox13 = new System.Windows.Forms.GroupBox();
...@@ -1096,7 +1096,7 @@ ...@@ -1096,7 +1096,7 @@
private System.Windows.Forms.Button button9; private System.Windows.Forms.Button button9;
private System.Windows.Forms.GroupBox groupBox10; private System.Windows.Forms.GroupBox groupBox10;
private HZH_Controls.Controls.UCMenu ucMenu1; private HZH_Controls.Controls.UCMenu ucMenu1;
private HZH_Controls.Controls.List.UCPagerControl2 ucPagerControl21; private HZH_Controls.Controls.UCPagerControl2 ucPagerControl21;
private System.Windows.Forms.GroupBox groupBox11; private System.Windows.Forms.GroupBox groupBox11;
private System.Windows.Forms.GroupBox groupBox12; private System.Windows.Forms.GroupBox groupBox12;
private HZH_Controls.Controls.UCBtnsGroup ucBtnsGroup1; private HZH_Controls.Controls.UCBtnsGroup ucBtnsGroup1;
......
...@@ -19,30 +19,32 @@ namespace Test ...@@ -19,30 +19,32 @@ namespace Test
private void FrmTemp1Test_Load(object sender, EventArgs e) private void FrmTemp1Test_Load(object sender, EventArgs e)
{ {
List<DataGridViewColumnEntity> lstCulumns = new List<DataGridViewColumnEntity>(); List<DataGridViewColumnEntity> lstCulumns = new List<DataGridViewColumnEntity>();
lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "ID", HeadText = "编号", Width = 70, WidthType = SizeType.Absolute }); lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "ID", HeadText = "编号", Width = 70, WidthType = SizeType.Absolute });
lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "Name", HeadText = "姓名", Width = 50, WidthType = SizeType.Percent }); lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "Name", HeadText = "姓名", Width = 50, WidthType = SizeType.Percent });
lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "Age", HeadText = "年龄", Width = 50, WidthType = SizeType.Percent }); lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "Age", HeadText = "年龄", Width = 50, WidthType = SizeType.Percent });
lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "Birthday", HeadText = "生日", Width = 50, WidthType = SizeType.Percent, Format = (a) => { return ((DateTime)a).ToString("yyyy-MM-dd"); } }); lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "Birthday", HeadText = "生日", Width = 50, WidthType = SizeType.Percent, Format = (a) => { return ((DateTime)a).ToString("yyyy-MM-dd"); } });
lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "Sex", HeadText = "性别", Width = 50, WidthType = SizeType.Percent, Format = (a) => { return ((int)a) == 0 ? "女" : "男"; } }); lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "Sex", HeadText = "性别", Width = 50, WidthType = SizeType.Percent, Format = (a) => { return ((int)a) == 0 ? "女" : "男"; } });
this.ucDataGridView1.Columns = lstCulumns; this.ucDataGridView1.Columns = lstCulumns;
this.ucDataGridView1.IsShowCheckBox = true; this.ucDataGridView1.IsShowCheckBox = true;
List<object> lstSource = new List<object>(); List<object> lstSource = new List<object>();
for (int i = 0; i < 20; i++) for (int i = 0; i < 200; i++)
{ {
TestModel model = new TestModel() TestModel model = new TestModel()
{ {
ID = i.ToString(), ID = i.ToString(),
Age = 3 * i, Age = 3 * i,
Name = "姓名——" + i, Name = "姓名——" + i,
Birthday = DateTime.Now.AddYears(-10), Birthday = DateTime.Now.AddYears(-10),
Sex = i % 2 Sex = i % 2
}; };
lstSource.Add(model); lstSource.Add(model);
} }
this.ucDataGridView1.DataSource = lstSource; var page = new UCPagerControl2();
this.ucDataGridView1.First(); page.DataSource = lstSource;
this.ucDataGridView1.Page = page;
this.ucDataGridView1.First();
} }
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!