589 Star 4.7K Fork 1.2K

冰封一夏 / HZHControls控件库

 / 详情

UCListView在获取cell总数的时候报错

待办的
创建于  
2020-07-15 22:11
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

评论 (0)

yxqdmlh 创建了任务
展开全部操作日志

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(1)
C#
1
https://gitee.com/kwwwvagaa/net_winform_custom_control.git
git@gitee.com:kwwwvagaa/net_winform_custom_control.git
kwwwvagaa
net_winform_custom_control
HZHControls控件库

搜索帮助