- 积分
- 0
- 在线时间
- 8 小时
- 主题
- 3
- 注册时间
- 2015-6-23
- 帖子
- 9
- 最后登录
- 2015-11-4
- 帖子
- 9
- 软币
- 117
- 在线时间
- 8 小时
- 注册时间
- 2015-6-23
|
DevExpress动态添加100多个checkEdit控件,加载速度很慢,大家有没有好的解决办法代码如下:
private void LoadModuleFunction()
{
IList<SysModule> modulelist = null;
IList<SysFunction> allSysFunctions = null;
int userTypeId = GlobalContext.Current.UserType.SutId;
//模块列表
modulelist = SysModuleBll.Instance.GetAllSysModules().Where(m => m.SmdStatus == 1).ToList();
//所有可用功能
allSysFunctions = SysFunctionBll.Instance.GetAllSysFunctions().Where(f => f.SfStatus == 1).ToList();
if (modulelist != null && modulelist.Count > 0)
{
for (int i = 0; i < modulelist.Count; i++)
{
//模块
LayoutControlGroup laygroup = new LayoutControlGroup();
laygroup.Text = modulelist[i].SmdRemark;
layout.AddGroup(laygroup);
//功能文件夹
IList<SysFunction> functionlist = null;
//功能文件夹
functionlist =
allSysFunctions.Where(f => f.SfModuleId == modulelist[i].SmdId && f.SfIsFile == 1).ToList();
if (functionlist != null && functionlist.Count > 0)
{
for (int j = 0; j < functionlist.Count; j++)
{
LayoutControlItem itemName = CreateItemWithBoundEditor(new CheckEdit(), functionlist[j],
functionlist[j].SfRemark, functionlist[j].SfName, laygroup, true);
//功能点
IList<SysFunction> functionpointlist = null;
functionpointlist =
allSysFunctions.Where(f => f.SfFileId == functionlist[j].SfId).ToList();
if (functionpointlist != null && functionpointlist.Count > 0)
{
for (int k = 0; k < functionpointlist.Count; k++)
{
LayoutControlItem item = CreateItemWithBoundEditor(new CheckEdit(), functionpointlist[k],
functionpointlist[k].SfRemark, functionpointlist[k].SfName, laygroup);
if (k == 0)
{
item.Move(itemName, InsertType.Right);
item.Location = new Point(120, itemName.ViewInfo.Offset.Y);
}
else
{
laygroup.Items[laygroup.Items.Count - 1].Move(laygroup.Items[laygroup.Items.Count - 2], InsertType.Right);
laygroup.Items[laygroup.Items.Count - 1].Location = new Point(100 * (k + 1), item.ViewInfo.Offset.Y);
}
}
}
}
}
}
layout.Root.Add(new LayoutControlItem() { TextVisible = false });
SimpleButton sbtnSave = new SimpleButton();
sbtnSave.Text = "保 存 ";
sbtnSave.Click += (sbtnSave_Click);
this.panelButton.Controls.Add(sbtnSave);
sbtnSave.Location = new Point(25, 14);
}
}
大家帮忙看看
|
|