/// <summary> /// 添加类别到表格中 /// </summary> /// <param name="categories">类别</param> public void AddCategoriesToCategoryGrid(List <UserSecurityCategory> categories) { if (m_gridCategory.EditTextBox != null) { m_gridCategory.OnCellEditEnd(null); } m_gridCategory.BeginUpdate(); int categoriesSize = categories.Count; for (int i = 0; i < categoriesSize; i++) { UserSecurityCategory category = categories[i]; GridRow row = new GridRow(); row.Grid = m_gridCategory; GridStringCell idCell = new GridStringCell(); idCell.Text = category.m_categoryID; row.AddCell(0, idCell); GridStringCell textCell = new GridStringCell(); textCell.AllowEdit = true; textCell.Text = category.m_name; row.AddCell(1, textCell); m_gridCategory.AddRow(row); if (i == 0) { m_gridCategory.OnCellEditBegin(textCell); } } m_gridCategory.EndUpdate(); m_gridCategory.Invalidate(); }
/// <summary> /// 增加证券到表格中 /// </summary> /// <param name="securities">证券列表</param> public void AddSecuritiesToSecuritiesGrid(List <Security> securities) { Dictionary <String, String> existsCodes = new Dictionary <String, String>(); List <GridRow> rows = m_gridSecurities.GetRows(); int rowSize = rows.Count; for (int i = 0; i < rowSize; i++) { GridRow row = rows[i]; String code = row.GetCell(0).GetString(); existsCodes[code] = ""; } int securitiesSize = securities.Count; m_gridSecurities.BeginUpdate(); for (int i = 0; i < securitiesSize; i++) { Security security = securities[i]; if (!existsCodes.ContainsKey(security.m_code)) { GridRow row = new GridRow(); m_gridSecurities.AddRow(row); row.AddCell(0, new GridStringCell(security.m_code)); row.AddCell(1, new GridStringCell(security.m_name)); existsCodes[security.m_code] = ""; } } m_gridSecurities.EndUpdate(); m_gridSecurities.Invalidate(); }
/// <summary> /// 添加指标列 /// </summary> private void AddIndicatorColumns() { if (m_task != null) { m_gridFilterResult.BeginUpdate(); CIndicator indicator = m_task.Indicator; foreach (String name in indicator.MainVariables.Keys) { GridColumn column = new GridColumn(name); column.Name = name; column.TextAlign = ContentAlignmentA.MiddleRight; column.Width = 80; m_gridFilterResult.AddColumn(column); if (name == "FILTER") { column.Text = "符合条件"; } } List <GridColumn> columns = m_gridFilterResult.GetColumns(); int columnsSize = columns.Count; for (int i = 0; i < columnsSize; i++) { GridColumn column = columns[i]; column.AllowResize = true; column.BackColor = CDraw.PCOLORS_BACKCOLOR4; column.BorderColor = COLOR.EMPTY; column.Font = new FONT("SimSun", 14, false, false, false); column.ForeColor = CDraw.PCOLORS_FORECOLOR7; } m_gridFilterResult.EndUpdate(); } }
/// <summary> /// 添加成员到结果表格 /// </summary> /// <param name="staffs">成员</param> public void AddToResultGrid(List <StaffInfo> staffs) { Dictionary <String, String> existsIds = new Dictionary <String, String>(); List <GridRow> rows = m_gridResult.GetRows(); int rowSize = rows.Count; for (int i = 0; i < rowSize; i++) { GridRow row = rows[i]; String id = row.GetCell(0).GetString(); existsIds[id] = ""; } int staffsSize = staffs.Count; m_gridResult.BeginUpdate(); for (int i = 0; i < staffsSize; i++) { StaffInfo staff = staffs[i]; if (!existsIds.ContainsKey(staff.m_jobID)) { GridRow row = new GridRow(); m_gridResult.AddRow(row); row.AddCell(0, new GridStringCell(staff.m_jobID)); row.AddCell(1, new GridStringCell(staff.m_name)); existsIds[staff.m_jobID] = ""; } } m_gridResult.EndUpdate(); m_gridResult.Invalidate(); }
/// <summary> /// 过滤查找 /// </summary> public void FilterSearch() { String sText = m_searchTextBox.Text.ToUpper(); m_grid.BeginUpdate(); m_grid.ClearRows(); int row = 0; CList <GSecurity> securities = SecurityService.FilterCode(sText); if (securities != null) { int rowCount = securities.size(); for (int i = 0; i < rowCount; i++) { GSecurity security = securities.get(i); GridRow gridRow = new GridRow(); m_grid.AddRow(gridRow); gridRow.AddCell(0, new GridStringCell(security.m_code)); gridRow.AddCell(1, new GridStringCell(security.m_name)); row++; } } securities.Dispose(); m_grid.EndUpdate(); }
/// <summary> /// 设置股票账户持仓信息 /// </summary> /// <param name="stockPositionResult"></param> private void SetSecurityPosition(String stockPositionResult) { m_dictSecurityPositions.Clear(); if (stockPositionResult == null || stockPositionResult.Length == 0) { return; } String[] lines = stockPositionResult.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (lines == null || lines.Length < 2) { return; } m_gridPositionAccount.BeginUpdate(); m_gridPositionAccount.ClearRows(); for (int i = 1; i < lines.Length; i++) { SecurityPosition position = SecurityPosition.ConvertToStockPosition(lines[i]); if (position != null) { m_dictSecurityPositions[position.m_stockCode] = position; GridRow row = new GridRow(); m_gridPositionAccount.AddRow(row); GridCell cell = new GridStringCell(position.m_stockCode); row.AddCell(0, cell); cell = new GridStringCell(position.m_stockName); row.AddCell(1, cell); cell = new GridDoubleCell(position.m_stockBalance); row.AddCell(2, cell); cell = new GridDoubleCell(position.m_availableBalance); row.AddCell(3, cell); cell = new GridDoubleCell(position.m_volume); row.AddCell(4, cell); cell = new GridDoubleCell(position.m_frozenVolume); row.AddCell(5, cell); cell = new GridDoubleCell(position.m_positionProfit); row.AddCell(6, cell); cell = new GridDoubleCell(position.m_positionCost); row.AddCell(7, cell); cell = new GridDoubleCell(position.m_positionProfitRatio); row.AddCell(8, cell); cell = new GridDoubleCell(position.m_marketPrice); row.AddCell(9, cell); cell = new GridDoubleCell(position.m_marketValue); row.AddCell(10, cell); cell = new GridDoubleCell(position.m_redemptionVolume); row.AddCell(11, cell); cell = new GridStringCell(position.m_marketName); row.AddCell(12, cell); cell = new GridStringCell(position.m_investorAccount); row.AddCell(13, cell); } } m_gridPositionAccount.EndUpdate(); m_gridPositionAccount.Invalidate(); }
/// <summary> /// 添加数据 /// </summary> public void AddData(List <Expression> list, String str) { m_searchTable.BeginUpdate(); GridRow row = new GridRow(); m_searchTable.AddRow(row); String strEx = ""; for (int i = 0; i < list.Count; i++) { Expression expression = list[i]; strEx += expression.getExpression(); } GridCell cell1 = new GridCellExp(str); row.AddCell("colT1", cell1); GridCell cell = new GridCellExp(strEx); row.AddCell("colT2", cell); m_searchTable.EndUpdate(); m_searchTable.Invalidate(); }
/// <summary> /// 设置股票账户委托信息 /// </summary> /// <param name="commissionResult"></param> private void SetSecurityCommission(String commissionResult) { if (commissionResult == null || commissionResult.Length == 0) { return; } String[] lines = commissionResult.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (lines == null || lines.Length < 2) { return; } m_gridCommissionAccount.BeginUpdate(); m_gridCommissionAccount.ClearRows(); for (int i = 1; i < lines.Length; i++) { SecurityCommission commission = SecurityCommission.ConvertToSecurityCommission(lines[i]); if (commission != null) { GridRow row = new GridRow(); m_gridCommissionAccount.AddRow(row); GridCell cell = new GridStringCell(commission.m_orderDate); row.AddCell(0, cell); cell = new GridStringCell(commission.m_stockCode); row.AddCell(1, cell); cell = new GridStringCell(commission.m_stockName); row.AddCell(2, cell); cell = new GridStringCell(commission.m_operate); row.AddCell(3, cell); cell = new GridStringCell(commission.m_remark); row.AddCell(4, cell); cell = new GridDoubleCell(commission.m_orderVolume); row.AddCell(5, cell); cell = new GridDoubleCell(commission.m_tradeVolume); row.AddCell(6, cell); cell = new GridDoubleCell(commission.m_cancelVolume); row.AddCell(7, cell); cell = new GridDoubleCell(commission.m_orderPrice); row.AddCell(8, cell); cell = new GridStringCell(commission.m_orderType); row.AddCell(9, cell); cell = new GridDoubleCell(commission.m_tradeAvgPrice); row.AddCell(10, cell); cell = new GridStringCell(commission.m_orderSysID); row.AddCell(11, cell); } } m_gridCommissionAccount.EndUpdate(); m_gridCommissionAccount.Invalidate(); }
/// <summary> /// 设置股票账户成交信息 /// </summary> /// <param name="tradeResult"></param> private void SetSecurityTrade(String tradeResult) { if (tradeResult == null || tradeResult.Length == 0) { return; } String[] lines = tradeResult.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (lines == null || lines.Length < 2) { return; } m_gridTradeAccount.BeginUpdate(); m_gridTradeAccount.ClearRows(); for (int i = 1; i < lines.Length; i++) { SecurityTrade trade = SecurityTrade.ConvertToStockTrade(lines[i]); if (trade != null) { GridRow row = new GridRow(); m_gridTradeAccount.AddRow(row); GridCell cell = new GridStringCell(trade.m_tradeDate); row.AddCell(0, cell); cell = new GridStringCell(trade.m_stockCode); row.AddCell(1, cell); cell = new GridStringCell(trade.m_stockName); row.AddCell(2, cell); cell = new GridStringCell(trade.m_operate); row.AddCell(3, cell); cell = new GridDoubleCell(trade.m_tradeVolume); row.AddCell(4, cell); cell = new GridDoubleCell(trade.m_tradeAvgPrice); row.AddCell(5, cell); cell = new GridDoubleCell(trade.m_tradeAmount); row.AddCell(6, cell); cell = new GridStringCell(trade.m_orderSysID); row.AddCell(7, cell); cell = new GridStringCell(trade.m_orderTradeID); row.AddCell(8, cell); cell = new GridDoubleCell(trade.m_cancelVolume); row.AddCell(9, cell); cell = new GridDoubleCell(trade.m_stockBalance); row.AddCell(10, cell); } } m_gridTradeAccount.EndUpdate(); m_gridTradeAccount.Invalidate(); }
/// <summary> /// 绑定指示 /// </summary> private void BindLevels() { m_gridLevels.CellEditMode = GridCellEditMode.DoubleClick; List <LevelInfo> levels = DataCenter.LevelService.m_levels; int levelsSize = levels.Count; m_gridLevels.ClearRows(); m_gridLevels.BeginUpdate(); for (int i = 0; i < levelsSize; i++) { LevelInfo level = levels[i]; AddLevelToGrid(level); } m_gridLevels.EndUpdate(); m_gridLevels.Invalidate(); }
/// <summary> /// 绑定员工 /// </summary> private void BindGits() { m_gridGit.CellEditMode = GridCellEditMode.DoubleClick; List <GitInfo> gits = DataCenter.GitService.m_gits; int gitsSize = gits.Count; m_gridGit.ClearRows(); m_gridGit.BeginUpdate(); for (int i = 0; i < gitsSize; i++) { GitInfo git = gits[i]; AddGitToGrid(git); } m_gridGit.EndUpdate(); m_gridGit.Invalidate(); }
/// <summary> /// 绑定员工 /// </summary> private void BindAwards() { m_gridAwards.CellEditMode = GridCellEditMode.DoubleClick; List <AwardInfo> awards = DataCenter.AwardService.m_awards; int awardsSize = awards.Count; m_gridAwards.ClearRows(); m_gridAwards.BeginUpdate(); for (int i = 0; i < awardsSize; i++) { AwardInfo award = awards[i]; AddAwardToGrid(award); } m_gridAwards.EndUpdate(); m_gridAwards.Invalidate(); }
/// <summary> /// 绑定线索 /// </summary> private void BindClues() { m_gridOpinions.CellEditMode = GridCellEditMode.DoubleClick; List <OpinionInfo> clues = DataCenter.OpinionService.m_opinions; int opinionsSize = clues.Count; m_gridOpinions.ClearRows(); m_gridOpinions.BeginUpdate(); for (int i = 0; i < opinionsSize; i++) { OpinionInfo opinion = clues[i]; AddOpinionToGrid(opinion); } m_gridOpinions.EndUpdate(); m_gridOpinions.Invalidate(); }
/// <summary> /// 绑定信息 /// </summary> private void BindCodes() { m_gridBSStocks.CellEditMode = GridCellEditMode.DoubleClick; List <BSStockInfo> codes = DataCenter.BSStockService.m_bsStocks; int codesSize = codes.Count; m_gridBSStocks.ClearRows(); m_gridBSStocks.BeginUpdate(); for (int i = 0; i < codesSize; i++) { BSStockInfo bsStock = codes[i]; AddCodeToGrid(bsStock); } m_gridBSStocks.EndUpdate(); m_gridBSStocks.Invalidate(); }
/// <summary> /// 绑定指示 /// </summary> private void BindFollows() { m_gridFollows.CellEditMode = GridCellEditMode.DoubleClick; List <FollowInfo> follows = DataCenter.FollowService.m_follows; int followsSize = follows.Count; m_gridFollows.ClearRows(); m_gridFollows.BeginUpdate(); for (int i = 0; i < followsSize; i++) { FollowInfo follow = follows[i]; AddFollowToGrid(follow); } m_gridFollows.EndUpdate(); m_gridFollows.Invalidate(); }
/// <summary> /// 绑定员工 /// </summary> private void BindProjects() { m_gridProjects.CellEditMode = GridCellEditMode.DoubleClick; List <ProjectInfo> projects = DataCenter.ProjectService.m_projects; int projectsSize = projects.Count; m_gridProjects.ClearRows(); m_gridProjects.BeginUpdate(); for (int i = 0; i < projectsSize; i++) { ProjectInfo project = projects[i]; AddProjectToGrid(project); } m_gridProjects.EndUpdate(); m_gridProjects.Invalidate(); }
/// <summary> /// 绑定指示 /// </summary> private void BindMasters() { m_gridExams.CellEditMode = GridCellEditMode.DoubleClick; List <ExamInfo> masters = DataCenter.ExamService.m_exams; int mastersSize = masters.Count; m_gridExams.ClearRows(); m_gridExams.BeginUpdate(); for (int i = 0; i < mastersSize; i++) { ExamInfo report = masters[i]; AddExamToGrid(report); } m_gridExams.EndUpdate(); m_gridExams.Invalidate(); }
/// <summary> /// 绑定指示 /// </summary> private void BindEvents() { m_gridEvents.CellEditMode = GridCellEditMode.DoubleClick; List <EventInfo> events = DataCenter.CalendarService.GetEvents(GetSelectedDay()); int eventsSize = events.Count; m_gridEvents.ClearRows(); m_gridEvents.BeginUpdate(); for (int i = 0; i < eventsSize; i++) { EventInfo eventInfo = events[i]; AddEventToGrid(eventInfo); } m_gridEvents.EndUpdate(); m_gridEvents.Invalidate(); }
/// <summary> /// 绑定服务器 /// </summary> private void BindServers() { m_gridRemotes.CellEditMode = GridCellEditMode.DoubleClick; List <RemoteInfo> remotes = DataCenter.RemoteService.m_remotes; int serversSize = remotes.Count; m_gridRemotes.ClearRows(); m_gridRemotes.BeginUpdate(); for (int i = 0; i < serversSize; i++) { RemoteInfo remote = remotes[i]; AddRemoteToGrid(remote); } m_gridRemotes.EndUpdate(); m_gridRemotes.Invalidate(); }
/// <summary> /// 绑定服务器 /// </summary> private void BindServers() { m_gridServers.CellEditMode = GridCellEditMode.DoubleClick; List <ServerInfo> servers = DataCenter.ServerService.m_servers; int serversSize = servers.Count; m_gridServers.ClearRows(); m_gridServers.BeginUpdate(); for (int i = 0; i < serversSize; i++) { ServerInfo server = servers[i]; AddServerToGrid(server); } m_gridServers.EndUpdate(); m_gridServers.Invalidate(); }
/// <summary> /// 绑定指示 /// </summary> private void BindMasters() { m_gridMasters.CellEditMode = GridCellEditMode.DoubleClick; List <MasterInfo> masters = DataCenter.MasterService.m_masters; int mastersSize = masters.Count; m_gridMasters.ClearRows(); m_gridMasters.BeginUpdate(); for (int i = 0; i < mastersSize; i++) { MasterInfo master = masters[i]; AddMasterToGrid(master); } m_gridMasters.EndUpdate(); m_gridMasters.Invalidate(); }
/// <summary> /// 绑定指示 /// </summary> private void BindCards() { m_gridBusinessCards.CellEditMode = GridCellEditMode.DoubleClick; List <BusinessCardInfo> cards = DataCenter.BusinessCardService.m_businessCards; int cardsSize = cards.Count; m_gridBusinessCards.ClearRows(); m_gridBusinessCards.BeginUpdate(); for (int i = 0; i < cardsSize; i++) { BusinessCardInfo card = cards[i]; AddCardToGrid(card); } m_gridBusinessCards.EndUpdate(); m_gridBusinessCards.Invalidate(); }
/// <summary> /// 绑定线索 /// </summary> private void BindClues() { m_gridClues.CellEditMode = GridCellEditMode.DoubleClick; List <ClueInfo> clues = DataCenter.ClueService.m_clues; int opinionsSize = clues.Count; m_gridClues.ClearRows(); m_gridClues.BeginUpdate(); for (int i = 0; i < opinionsSize; i++) { ClueInfo clue = clues[i]; AddClueToGrid(clue); } m_gridClues.EndUpdate(); m_gridClues.Invalidate(); }
/// <summary> /// 绑定员工 /// </summary> private void BindStaffs() { m_gridStaffs.CellEditMode = GridCellEditMode.DoubleClick; List <StaffInfo> staffs = DataCenter.StaffService.m_staffs; int staffsSize = staffs.Count; m_gridStaffs.ClearRows(); m_gridStaffs.BeginUpdate(); for (int i = 0; i < staffsSize; i++) { StaffInfo staff = staffs[i]; AddStaffToGrid(staff); } m_gridStaffs.EndUpdate(); m_gridStaffs.Invalidate(); }
/// <summary> /// 绑定员工 /// </summary> public void BindStaffs() { m_gridStaffs.BeginUpdate(); List <StaffInfo> staffs = DataCenter.StaffService.GetAliveStaffs(); int staffsSize = staffs.Count; for (int i = 0; i < staffsSize; i++) { StaffInfo staff = staffs[i]; GridRow row = new GridRow(); m_gridStaffs.AddRow(row); row.AddCell(0, new GridStringCell(staff.m_jobID)); row.AddCell(1, new GridStringCell(staff.m_name)); } m_gridStaffs.EndUpdate(); m_gridStaffs.Invalidate(); }
/// <summary> /// 绑定待选证券到表格 /// </summary> /// <param name="securities">证券列表</param> public void BindSecuritiesToSelectSecuritiesGrid(List <Security> securities) { m_gridSelectSecurities.BeginUpdate(); m_gridSelectSecurities.ClearRows(); int securitiesSize = securities.Count; for (int i = 0; i < securitiesSize; i++) { Security security = securities[i]; GridRow row = new GridRow(); m_gridSelectSecurities.AddRow(row); row.AddCell(0, new GridStringCell(security.m_code)); row.AddCell(1, new GridStringCell(security.m_name)); } m_gridSelectSecurities.EndUpdate(); m_gridSelectSecurities.Invalidate(); }
/// <summary> /// 添加模板到表格控件中 /// </summary> /// <param name="serverInfos">服务器信息</param> private void AddServersToGrid(List <ServerInfo> serverInfos) { m_gridServers.BeginUpdate(); int serversInfosSize = serverInfos.Count; GridRow selectedRow = null; for (int i = 0; i < serversInfosSize; i++) { ServerInfo serverInfo = serverInfos[i]; GridRow row = new GridRow(); row.Grid = m_gridServers; GridStringCell idCell = new GridStringCell(); idCell.Grid = m_gridServers; idCell.Column = m_gridServers.GetColumn(0); idCell.Text = serverInfo.m_id; row.AddCell(0, idCell); GridStringCell ipCell = new GridStringCell(); ipCell.Grid = m_gridServers; ipCell.Column = m_gridServers.GetColumn(1); ipCell.Text = serverInfo.m_ip; row.AddCell(1, ipCell); GridStringCell portCell = new GridStringCell(); portCell.Grid = m_gridServers; portCell.Column = m_gridServers.GetColumn(2); portCell.Text = serverInfo.m_port.ToString(); row.AddCell(2, portCell); GridStringCell typeCell = new GridStringCell(); typeCell.Grid = m_gridServers; typeCell.Column = m_gridServers.GetColumn(3); typeCell.Text = serverInfo.m_type; row.AddCell(3, typeCell); m_gridServers.AddRow(row); selectedRow = row; } //选中行 if (selectedRow != null) { List <GridRow> selectedRows = new List <GridRow>(); selectedRows.Add(selectedRow); m_gridServers.SelectedRows = selectedRows; } m_gridServers.EndUpdate(); m_gridServers.VScrollBar.ScrollToEnd(); }
/// <summary> /// 添加控件方法 /// </summary> public override void OnLoad() { base.OnLoad(); if (m_grid == null) { m_grid = new GridA(); m_grid.AutoEllipsis = true; m_grid.GridLineColor = COLOR.EMPTY; m_grid.Size = new SIZE(240, 200); m_grid.RegisterEvent(m_gridCellClickEvent, EVENTID.GRIDCELLCLICK); m_grid.RegisterEvent(m_gridKeyDownEvent, EVENTID.KEYDOWN); AddControl(m_grid); m_grid.BeginUpdate(); //添加列 GridColumn securityCodeColumn = new GridColumn("股票代码"); securityCodeColumn.BackColor = CDraw.PCOLORS_BACKCOLOR; securityCodeColumn.BorderColor = COLOR.EMPTY; securityCodeColumn.Font = new FONT("Simsun", 14, true, false, false); securityCodeColumn.ForeColor = CDraw.PCOLORS_FORECOLOR; securityCodeColumn.TextAlign = ContentAlignmentA.MiddleLeft; securityCodeColumn.Width = 120; m_grid.AddColumn(securityCodeColumn); GridColumn securityNameColumn = new GridColumn("股票名称"); securityNameColumn.BackColor = CDraw.PCOLORS_BACKCOLOR; securityNameColumn.BorderColor = COLOR.EMPTY; securityNameColumn.Font = new FONT("Simsun", 14, true, false, false); securityNameColumn.ForeColor = CDraw.PCOLORS_FORECOLOR; securityNameColumn.TextAlign = ContentAlignmentA.MiddleLeft; securityNameColumn.Width = 110; m_grid.AddColumn(securityNameColumn); m_grid.EndUpdate(); } if (m_searchTextBox == null) { m_searchTextBox = new TextBoxA(); m_searchTextBox.Location = new POINT(0, 200); m_searchTextBox.Size = new SIZE(240, 20); m_searchTextBox.Font = new FONT("SimSun", 16, true, false, false); m_searchTextBox.RegisterEvent(m_textBoxInputChangedEvent, EVENTID.TEXTCHANGED); m_searchTextBox.RegisterEvent(m_textBoxKeyDownEvent, EVENTID.KEYDOWN); AddControl(m_searchTextBox); } }
/// <summary> /// 绑定指示 /// </summary> private void BindDialogs() { m_gridDialogs.CellEditMode = GridCellEditMode.DoubleClick; List <DialogInfo> dialogs = DataCenter.DialogService.m_dialogs; int dialogsSize = dialogs.Count; m_gridDialogs.ClearRows(); m_gridDialogs.BeginUpdate(); for (int i = 0; i < dialogsSize; i++) { DialogInfo dialog = dialogs[i]; dialog.m_date = dialog.m_date.Replace("-", ""); AddDialogToGrid(dialog); } m_gridDialogs.EndUpdate(); if (m_gridDialogs.VScrollBar != null && m_gridDialogs.VScrollBar.Visible) { m_gridDialogs.VScrollBar.ScrollToEnd(); } m_gridDialogs.Invalidate(); }
/// <summary> /// 添加模板到表格控件中 /// </summary> /// <param name="templates">模板列表</param> private void AddTemplatesToGrid(List <SecurityFilterTemplate> templates) { m_gridTemplate.BeginUpdate(); int templatesSize = templates.Count; for (int i = 0; i < templatesSize; i++) { SecurityFilterTemplate template = templates[i]; GridRow row = new GridRow(); row.Grid = m_gridTemplate; GridStringCell idCell = new GridStringCell(); idCell.Grid = m_gridTemplate; idCell.Column = m_gridTemplate.GetColumn(0); idCell.Text = template.m_templateID; row.AddCell(0, idCell); GridStringCell textCell = new GridStringCell(); textCell.Grid = m_gridTemplate; textCell.Column = m_gridTemplate.GetColumn(1); textCell.Text = template.m_name; row.AddCell(1, textCell); m_gridTemplate.AddRow(row); } m_gridTemplate.EndUpdate(); }