Commit 5452207c HZH

listview bug

1 个父辈 2721a706
......@@ -62,6 +62,7 @@
this.Margin = new System.Windows.Forms.Padding(0);
this.Name = "UCListView";
this.Size = new System.Drawing.Size(462, 363);
this.Load += new System.EventHandler(this.UCListView_Load);
this.ResumeLayout(false);
}
......
......@@ -149,6 +149,10 @@ namespace HZH_Controls.Controls
public void ReloadSource()
{
ControlHelper.FreezeControl(this, true);
if (this.panMain.Controls.Count <= 0)
{
ReloadGridStyle();
}
if (m_dataSource == null || ((IList)m_dataSource).Count <= 0)
{
for (int i = this.panMain.Controls.Count - 1; i >= 0; i--)
......@@ -192,7 +196,6 @@ namespace HZH_Controls.Controls
/// </summary>
public void ReloadGridStyle()
{
Form frmMain = this.FindForm();
if (frmMain != null && !frmMain.IsDisposed && frmMain.Visible && this.Visible)
{
......@@ -296,12 +299,25 @@ namespace HZH_Controls.Controls
return;
Control item = (Control)Activator.CreateInstance(m_itemType);
int intXCount = (this.panMain.Width - 10) / (item.Width + 10);
m_intCellWidth = item.Width + ((this.panMain.Width - 10) % (item.Width + 10)) / intXCount;
int intYCount = (this.panMain.Height - 10) / (item.Height + 10);
m_intCellHeight = item.Height + ((this.panMain.Height - 10) % (item.Height + 10)) / intYCount;
CellCount = intXCount * intYCount;
int intCount = intXCount * intYCount;
if (Page == null)
{
if (((IList)m_dataSource).Count > intCount)
{
intXCount = (this.panMain.Width - 10 - 20) / (item.Width + 10);
m_intCellWidth = item.Width + ((this.panMain.Width - 10 - 20) % (item.Width + 10)) / intXCount;
}
intCount = Math.Max(intCount, ((IList)m_dataSource).Count);
}
CellCount = intCount;
}
#endregion
......@@ -309,5 +325,10 @@ namespace HZH_Controls.Controls
{
ReloadGridStyle();
}
private void UCListView_Load(object sender, EventArgs e)
{
}
}
}
......@@ -21,7 +21,7 @@ namespace Test
private void FrmTestListView_Load(object sender, EventArgs e)
{
List<object> lstSource = new List<object>();
for (int i = 0; i < 1000; i++)
for (int i = 0; i < 200; i++)
{
lstSource.Add("项-" + i);
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!