private void c1FlexGrid1_StartEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { if (comboBox1.SelectedIndex == 1) { SetupEditor(); } }
private void c1FlexGrid1_AfterEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { if (e.Col == 2) { if (this.c1FlexGrid1[e.Row, e.Col] != null && this.c1FlexGrid1[e.Row, e.Col] != DBNull.Value && this.c1FlexGrid1[e.Row, e.Col].ToString().Trim() != "") { string fieldName = this.c1FlexGrid1[e.Row, e.Col].ToString(); foreach (var item in queryEntity) { if (item.FieldDispaly == fieldName) { CellStyle style = this.c1FlexGrid1.Styles[item.FieldType]; this.c1FlexGrid1.SetCellStyle(e.Row, 4, style); CellStyle style2 = this.c1FlexGrid1.Styles[item.FieldType + "_RelationOp"]; this.c1FlexGrid1.SetCellStyle(e.Row, 3, style2); break; } } } else { this.c1FlexGrid1[e.Row, 3] = null; this.c1FlexGrid1[e.Row, 4] = null; } } }
private void c1FlexGrid1_StartEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { _editing = true; UpdateButtonsSatus(); if (_updating) { return; } var labelIndex = c1FlexGrid1.Cols.Fixed; var valueIndex = labelIndex + 1; var data = c1FlexGrid1.Rows[e.Row][e.Col]; var value = data == null ? "" : data.ToString(); if (e.Col == labelIndex) { _nameEditor.Value = value; c1FlexGrid1.Editor = _nameEditor; } else if (e.Col == valueIndex) { _valueEditor.ScriptName = string.Format("{0}[{1}].{2}", _scriptNamePrefix, e.Row - c1FlexGrid1.Rows.Fixed, "Value"); _valueEditor.Expression = value; c1FlexGrid1.Editor = _valueEditor; } else { c1FlexGrid1.Editor = null; } }
private void fgHarvard_StartEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { if (fgHarvard.Cols[e.Col].Name == "MoTa") { fgHarvard.Cols[e.Col].TextAlign = TextAlignEnum.LeftTop; fgHarvard.Rows[e.Row].Height = 60; } if (fgHarvard.Cols[e.Col].Name == "MucDo_AnhHuong") { fgHarvard.Cols[e.Col].TextAlign = TextAlignEnum.LeftTop; fgHarvard.Rows[e.Row].Height = 60; } if (fgHarvard.Cols[e.Col].Name == "NguyenNhan") { fgHarvard.Cols[e.Col].TextAlign = TextAlignEnum.LeftTop; fgHarvard.Rows[e.Row].Height = 60; } if (fgHarvard.Cols[e.Col].Name == "BienPhap") { fgHarvard.Cols[e.Col].TextAlign = TextAlignEnum.LeftTop; fgHarvard.Rows[e.Row].Height = 60; } if (fgHarvard.Cols[e.Col].Name == "GhiChu") { fgHarvard.Cols[e.Col].TextAlign = TextAlignEnum.LeftTop; fgHarvard.Rows[e.Row].Height = 60; } }
private void fgHarvard_AfterEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { var fg = fgHarvard; fg[e.Row, "IsEdit"] = "1"; if (fg.Cols[e.Col].Name == "MoTa") { fg.Cols[e.Col].TextAlign = TextAlignEnum.LeftCenter; } if (fg.Cols[e.Col].Name == "MucDo_AnhHuong") { fg.Cols[e.Col].TextAlign = TextAlignEnum.LeftCenter; } if (fg.Cols[e.Col].Name == "NguyenNhan") { fg.Cols[e.Col].TextAlign = TextAlignEnum.LeftCenter; } if (fg.Cols[e.Col].Name == "BienPhap") { fg.Cols[e.Col].TextAlign = TextAlignEnum.LeftCenter; } if (fg.Cols[e.Col].Name == "GhiChu") { fg.Cols[e.Col].TextAlign = TextAlignEnum.LeftCenter; } fg.AutoSizeRow(e.Row); }
void _flexMaster_AfterEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { if (_flexMaster.Cols[e.Col].Name == "Selected") { // the grid still has the focus and the cursor hasn't moved to a new row, // so the data source still doesn't see the row as changed. // so we use the currency manager to end the edits. CurrencyManager cm = (CurrencyManager)BindingContext[_flexMaster.DataSource, _flexMaster.DataMember]; cm.EndCurrentEdit(); // clear detail table dtDetails.BeginLoadData(); dtDetails.Clear(); // get selected orders DataTable dtOrders = ds.Tables["Orders"]; DataRow[] drOrders = dtOrders.Select("Selected = true"); // scan selected orders and add detail to new table foreach (DataRow drOrder in drOrders) { DataRow[] drDetails = drOrder.GetChildRows(ds.Relations[0]); foreach (DataRow drDetail in drDetails) { dtDetails.Rows.Add(drDetail.ItemArray); } } dtDetails.EndLoadData(); } }
private void _flex1_CellChanged(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { // invalidate row to force repaint if (_flex1.Cols[e.Col].Name == "UserDef") { _flex1.Invalidate(e.Row, -1); } }
private void vs_AfterEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { switch (vs.Cols[e.Col].Name) { case "REV_QT": CalculateBalanceQTY(e.Row); break; } }
void _flex_CellChanged(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { var value = _flex[e.Row, e.Col]; if (value is Color) { var rg = _flex.GetCellRange(e.Row, e.Col); rg.StyleNew.BackColor = (Color)value; } }
/// <summary> /// This function will be triggered after an edit event is fired. An event /// will be raised which can be subsribed to so that additional processing /// can be performed. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AfterEditEvent(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { if (!m_GridUpdateInProgress) { if (OnAfterEditEvent != null) { OnAfterEditEvent(sender, e); } } }
private void vs_AfterEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { switch (vs.Cols[e.Col].Name) { case "PAY_QT": CalculatePayQTY(e.Row); CalculateAmount(e.Row); break; } }
private void flexHangMuc_RowValidated(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { if (flexHangMuc.Rows.Count > 1) { if (flexHangMuc.Rows[e.Row]["Status"] != null && flexHangMuc.Rows[e.Row]["Status"].ToString().Equals(string.Empty)) { flexHangMuc.Rows[e.Row]["ID"] = Guid.NewGuid().ToString(); flexHangMuc.Rows[e.Row]["Status"] = "1"; } } }
// Use combo if checked. // By default, maps imply simple dropdowns. // Simple dropdowns also have autosearch, but the combo autosearch looks better. void _flex_SetupEditor(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { ComboBox cb = _flex.Editor as ComboBox; if (cb != null) { cb.DropDownStyle = _chkCombo.Checked ? ComboBoxStyle.DropDown : ComboBoxStyle.DropDownList; } }
// use custom editor to edit column 1 private void _flex_StartEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { if (e.Col == 1) { // start editing the cell with the custom editor _myEditor.StartEditing(e.Row, e.Col); // cancel built-in editor e.Cancel = true; } }
// show list of columns available on the selected table private void _flex_BeforeEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { _flex.ComboList = string.Empty; if (_flex.Cols[e.Col].Name == "Column") { DataTable dt = _flex[e.Row, "Table"] as DataTable; if (dt != null) { _flex.ComboList = _columns[dt] as string; } } }
// show criteria editor private void _flex_CellButtonClick(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { using (CriteriaForm f = new CriteriaForm()) { f.QueryField = _flex.Rows[e.Row].DataSource as QueryField; DialogResult dr = f.ShowDialog(); if (dr == DialogResult.OK) { _flex[e.Row, e.Col] = f.Value; } } }
private void grfPosi_CellChanged(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { //if (e.Row == 0) return; //CellStyle cs = grfDept.Styles.Add("text"); //cs.BackColor = Color.DimGray; //sB1.Text = grfDept[e.Row, e.Col].ToString(); ////grfDept[e.Row, coledit] = "1"; //grfDept.Rows[e.Row].Style = cs; //if((e.Row+1) == ((RowCollection)grfDept.Rows).Count) //{ // ((RowCollection)grfDept.Rows).Count = ((RowCollection)grfDept.Rows).Count + 1; //} }
private void vs1_AfterEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { if (vs1.Cols[e.Col].Name == "ALL_BT" && e.Row > 0) { // for(int i=e.Row+1;i<vs1.Rows.Count;i++) // { // if (((Node)ar[i]).Level<=lv) // break; // vs1.Rows[i]["ALL_BT"]=vs1.Rows[e.Row]["ALL_BT"]; // } edit = true; } }
private void c1FlexGrid1_CellChanged(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { CellStyle s = this._flex.Styles["Yellow"]; if (s == null) { s = this._flex.Styles.Add("Yellow"); s.BackColor = Color.Yellow; } this._flex.Invalidate(e.Row, -1); CellRange rg = this._flex.GetCellRange(e.Row, this._flex.Cols[1].Index); //rg.Style = ((bool)this.c1FlexGrid1[e.Row, 1]) ? s : null; }
private void c1FlexGrid1_BeforeEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { // if we begin to edit auto fill the date field if (e.Col == 2 || e.Col == 3) { if (c1FlexGrid1[e.Row, 1] == null && e.Row > 0) { if (c1FlexGrid1[e.Row - 1, 1] != null) { c1FlexGrid1[e.Row, 1] = ((DateTime)c1FlexGrid1[e.Row - 1, 1]).AddDays(1); } } } }
private void c1FlexGrid1_BeforeEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { _flex.EditOptions = EditFlags.All; var type = _flex.Cols[_flex.Col].DataType; if (type == typeof(int)) { _flex.EditOptions &= ~EditFlags.UseNumericEditor; } if (comboBox1.SelectedIndex == 2) { SetupEditor(); } }
private void vs1_AfterEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { if (vs1.Cols[e.Col].Name == "ALL_BT" && e.Row > 0) { int lv = ((Node)ar[e.Row]).Level; ((Node)ar[e.Row]).Expanded = (vs1.GetCellCheck(e.Row, e.Col) == CheckEnum.Checked); for (int i = e.Row + 1; i < vs1.Rows.Count; i++) { if (((Node)ar[i]).Level <= lv) { break; } vs1.Rows[i]["ALL_BT"] = vs1.Rows[e.Row]["ALL_BT"]; } edit = true; } }
// method 2: use styles to accomplish the same thing private void _flex2_CellChanged(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { if (_flex2.Cols[e.Col].Name == "UserDef" && _flex2[e.Row, "UserDef"] is bool) { // create style if we have to CellStyle s = _flex2.Styles["Yellow"]; if (s == null) { s = _flex2.Styles.Add("Yellow"); s.BackColor = Color.Yellow; } // apply style based on cell value CellRange rg = _flex2.GetCellRange(e.Row, _flex2.Cols["Length"].Index); rg.Style = ((bool)_flex2[e.Row, "UserDef"])? s: null; } }
private void c1FlexGrid1_AfterEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { //After edit, apply new changes to calculated columns if (isHeaderRow(e.Row)) { //If header row remove all numeric data if it exists and apply custom Heading CellStyle ClearRow(e.Row); this.c1FlexGrid1.SetCellStyle(e.Row, 0, c1FlexGrid1.Styles["Heading"]); } else { //Calculate new totals for current row CalculateGrossMargins(e.Row); CalculateDeviation(e.Row); } //Calculate new deviation for adjacent affected row CalculateDeviation(e.Row + 1); }
private void c1FlexGrid1_AfterEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { try { c1FlexGrid1.AutoSizeRow(e.Row); c1FlexGrid1.AutoSizeCol(e.Col); int hang = c1FlexGrid1.Row; int cot = c1FlexGrid1.Cols.Count - 1; if (Convert.ToInt32(c1FlexGrid1[hang, cot]) == 0) { c1FlexGrid1[c1FlexGrid1.RowSel, c1FlexGrid1.Cols.Count - 1] = 2; } if (c1FlexGrid1.Cols[c1FlexGrid1.ColSel].Name.ToLower().Equals("giadl5") == true && c1FlexGrid1.RowSel == c1FlexGrid1.Rows.Count - 1) { if (c1FlexGrid1.RowSel == c1FlexGrid1.Rows.Count - 1) { Add(); c1FlexGrid1.StartEditing(c1FlexGrid1.Rows.Count - 1, 1); } else { c1FlexGrid1.StartEditing(c1FlexGrid1.RowSel + 1, 2); } //Add(); c1FlexGrid1.StartEditing(c1FlexGrid1.Rows.Count - 1, 1); } //tinh gia nhap =gia mua+gia van chuyen double giamua = 0; double giavanchuyen = 0; try { giamua = Convert.ToDouble(c1FlexGrid1[c1FlexGrid1.RowSel, "giamua"].ToString()); } catch { } try { giavanchuyen = Convert.ToDouble(c1FlexGrid1[c1FlexGrid1.RowSel, "giavanchuyen"].ToString()); } catch { } c1FlexGrid1[c1FlexGrid1.RowSel, "gianhap"] = (giamua + giavanchuyen).ToString().Trim(); } catch { } }
private void vs_AfterEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { if (e.Col == 1 && e.Row > 0) { if (((Node)ar[e.Row]).Level == 1) { return; } ((Node)ar[e.Row]).Expanded = (vs.GetCellCheck(e.Row, e.Col) == CheckEnum.Checked); for (int i = e.Row + 1; i < vs.Rows.Count; i++) { if (((Node)ar[i]).Level == 0) { break; } vs.SetCellCheck(i, 1, vs.GetCellCheck(e.Row, e.Col)); } } }
private void vs_CellButtonClick(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { string sql = ""; sql = "Select EMP_ID,EMP_I1,EMP_NM,DEP_ID,POS_ID,LEV_ID from FILB01A where (VAC_BT is null or VAC_BT=0) and DEP_ID in (Select DEP_ID from SYS_SECURITY_DEP" + " where MNU_ID=" + this.Tag + " and ALL_BT=1 and USER_ID=N'" + PublicFunction.A_UserID + "')"; if (vs.Rows[vs.Row]["DEP_ID"] + "" != "") { sql += " and DEP_ID=N'" + vs.Rows[vs.Row]["DEP_ID"] + "'"; } Func.RecordSet rs = new Func.RecordSet(sql, PublicFunction.C_con); frmSearch dlg = new frmSearch(rs, 3, "frmTaStaffInfo_vs"); if (dlg.ShowDialog() == DialogResult.OK) { vs.Rows[vs.Row]["EMP_ID"] = rs.record(rs.Bookmarks, "EMP_ID"); } vs.AutoSizeCols(); }
private void c1FlexGrid1_AfterEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { if (_updating) { return; } var labelIndex = c1FlexGrid1.Cols.Fixed; var valueIndex = labelIndex + 1; if (e.Col == labelIndex) { c1FlexGrid1.Rows[e.Row][e.Col] = _nameEditor.Text; } else if (e.Col == valueIndex) { c1FlexGrid1.Rows[e.Row][e.Col] = _valueEditor.Expression; _valueEditor.Expression = ""; } }
private void GridCharacteristic_CellButtonClick(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { try { FlexGrid grdCharacteristic = sender as FlexGrid; CharCode = GetCharCode(grdCharacteristic.Name); //var charValue = grdCharacteristic.Rows[grdCharacteristic.Row][grdCharacteristic.Col - 1].ToString(); //var characteristicModel = CharacteristicValues.Where(c => c.CharCode == CharCode && c.CharValue == charValue).FirstOrDefault(); //if (characteristicModel != null && CommonFunc.ShowMessage("The selected record will be deleted. Are you sure?", MessageType.OKCancel) == DialogResult.OK) //{ // characteristicModel.CharStatus = "Deleted"; // DefaultGridSetting(ref grdCharacteristic, CharCode); //} } catch (Exception ex) { Logger.Log(ex, Logger.LogingLevel.Error); } }
/// <summary> /// 重复校验 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void GridSubjRela_LeaveEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { string yycode = GridSubjRela[e.Row, "snckemu_code"].ToString(); //dtSubjRela.Rows[e.Row - GridSubjRela.Rows.Fixed - 1]["snckemu_code"].ToString(); string yyname = GridSubjRela[e.Row, "snckemu_name"].ToString(); //dtSubjRela.Rows[e.Row - GridSubjRela.Rows.Fixed - 1]["snckemu_name"].ToString(); string cwcode = GridSubjRela[e.Row, "scwkemu_code"].ToString(); //dtSubjRela.Rows[e.Row - GridSubjRela.Rows.Fixed - 1]["scwkemu_code"].ToString(); bool fault = true; for (int i = GridSubjRela.Rows.Fixed; i < GridSubjRela.Rows.Count; i++) { if (i != e.Row && GridSubjRela.Rows[i]["snckemu_code"].ToString() == yycode && GridSubjRela.Rows[i]["snckemu_name"].ToString() == yyname && GridSubjRela.Rows[i]["scwkemu_code"].ToString() == cwcode) { UIP.FrameManager.SetStatusMessage("数据重复!【" + i + "】", true, Color.Red); fault = true; e.Cancel = true; } } if (!fault) { UIP.FrameManager.SetStatusMessage(" ", true, BackColor); } }