Commit b861ad78 HZH

修改分页控件bug

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