DevExpress动态添加100多个控件加载速度很慢
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.SmdRemark;
layout.AddGroup(laygroup);
//功能文件夹
IList<SysFunction> functionlist = null;
//功能文件夹
functionlist =
allSysFunctions.Where(f => f.SfModuleId == modulelist.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,
functionlist.SfRemark, functionlist.SfName, laygroup, true);
//功能点
IList<SysFunction> functionpointlist = null;
functionpointlist =
allSysFunctions.Where(f => f.SfFileId == functionlist.SfId).ToList();
if (functionpointlist != null && functionpointlist.Count > 0)
{
for (int k = 0; k < functionpointlist.Count; k++)
{
LayoutControlItem item = CreateItemWithBoundEditor(new CheckEdit(), functionpointlist,
functionpointlist.SfRemark, functionpointlist.SfName, laygroup);
if (k == 0)
{
item.Move(itemName, InsertType.Right);
item.Location = new Point(120, itemName.ViewInfo.Offset.Y);
}
else
{
laygroup.Items.Move(laygroup.Items, InsertType.Right);
laygroup.Items.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);
}
}
大家帮忙看看
页:
[1]