代码拉取完成,页面将自动刷新
private void GetCellCount()
{
if (DesignMode)
return;
if (this.panMain.Width == 0)
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;
int intCount = intXCount * intYCount;
if (Page == null)
{
if (m_dataSource == null)
{
intCount = 0;
}
else
{
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;
}
其中,int intXCount = (this.panMain.Width - 10) / (item.Width + 10);计算intXCount的时候除数为0