/// <summary> /// 过滤查找 /// </summary> public void filterSearch() { String sText = m_searchTextBox.Text.ToUpper(); m_grid.beginUpdate(); m_grid.clearRows(); int row = 0; CList <Security> securities = SecurityService.FilterCode(sText); if (securities != null) { int rowCount = securities.size(); for (int i = 0; i < rowCount; i++) { Security security = securities.get(i); FCGridRow gridRow = new FCGridRow(); m_grid.addRow(gridRow); gridRow.addCell(0, new FCGridStringCell(security.m_code)); gridRow.addCell(1, new FCGridStringCell(security.m_name)); row++; } } securities.delete(); m_grid.endUpdate(); }
/// <summary> /// 添加控件方法 /// </summary> public override void onLoad() { base.onLoad(); if (m_grid == null) { m_grid = new FCGrid(); m_grid.AutoEllipsis = true; m_grid.GridLineColor = FCColor.None; m_grid.Size = new FCSize(240, 200); m_grid.addEvent(m_gridCellClickEvent, FCEventID.GRIDCELLCLICK); m_grid.addEvent(m_gridKeyDownEvent, FCEventID.KEYDOWN); addControl(m_grid); m_grid.beginUpdate(); //添加列 FCGridColumn securityCodeColumn = new FCGridColumn("股票代码"); securityCodeColumn.BackColor = FCDraw.FCCOLORS_BACKCOLOR; securityCodeColumn.BorderColor = FCColor.None; securityCodeColumn.Font = new FCFont("Simsun", 14, true, false, false); securityCodeColumn.TextColor = FCDraw.FCCOLORS_FORECOLOR; securityCodeColumn.TextAlign = FCContentAlignment.MiddleLeft; securityCodeColumn.Width = 120; m_grid.addColumn(securityCodeColumn); FCGridColumn securityNameColumn = new FCGridColumn("股票名称"); securityNameColumn.BackColor = FCDraw.FCCOLORS_BACKCOLOR; securityNameColumn.BorderColor = FCColor.None; securityNameColumn.Font = new FCFont("Simsun", 14, true, false, false); securityNameColumn.TextColor = FCDraw.FCCOLORS_FORECOLOR; securityNameColumn.TextAlign = FCContentAlignment.MiddleLeft; securityNameColumn.Width = 110; m_grid.addColumn(securityNameColumn); m_grid.endUpdate(); } if (m_searchTextBox == null) { m_searchTextBox = new FCTextBox(); m_searchTextBox.Location = new FCPoint(0, 200); m_searchTextBox.Size = new FCSize(240, 20); m_searchTextBox.Font = new FCFont("SimSun", 16, true, false, false); m_searchTextBox.addEvent(m_textBoxInputChangedEvent, FCEventID.TEXTCHANGED); m_searchTextBox.addEvent(m_textBoxKeyDownEvent, FCEventID.KEYDOWN); addControl(m_searchTextBox); } }