public override void InvokeAction(object sender, EventArgs e) { if (this.ActiveGrid != null) { GridStyleInfo style = new GridStyleInfo(); GridCurrentCell cc = this.ActiveGrid.CurrentCell; GridControlBase grid = ActiveGrid; if (this.ActiveGrid.Model[cc.RowIndex, cc.ColIndex].Font.Bold) { style.Font.Bold = false; } else { style.Font.Bold = true; } ApplyStyle(style); } //ContainerControl c = MainWindow; //while (c != null) //{ // if (c is SplitterControl) // { // ((SplitterControl) c).ScrollBarColor = Color.Red; // break; // } // c = c.ActiveControl is ContainerControl ? (ContainerControl) c.ActiveControl : null; //} }
private void gridControl_CurrentCellValidated(object sender, EventArgs e) { var grid = (GridControl)sender; GridCurrentCell cc = grid.CurrentCell; var itemPengeluaran = _listOfItemPengeluaran[cc.RowIndex - 1]; var jenisPengeluaran = itemPengeluaran.JenisPengeluaran; if (jenisPengeluaran != null) { switch (cc.ColIndex) { case 3: // kolom jumlah itemPengeluaran.jumlah = NumberHelper.StringToDouble(cc.Renderer.ControlValue.ToString(), true); break; case 4: // kolom harga itemPengeluaran.harga = NumberHelper.StringToDouble(cc.Renderer.ControlValue.ToString()); break; default: break; } SetItemJenisPengeluaran(grid, cc.RowIndex, cc.ColIndex, jenisPengeluaran, itemPengeluaran.jumlah, itemPengeluaran.harga); grid.Refresh(); RefreshTotal(); } }
public void MouseDown(MouseEventArgs e) { cc = this.grid.CurrentCell; if (e.Button == MouseButtons.Left) { if (e.Clicks == 1) { // Start automatic scrolling when user drags mouse out of window grid.AutoScrolling = ScrollBars.Both; // int rowIndex, colIndex; Point point = new Point(e.X, e.Y); grid.PointToRowCol(point, out rowIndex, out colIndex); activeRange = grid.Selections.Ranges.ActiveRange; dragWindow = new DragWindow(); dragWindow.Opacity = .2f; dragWindow.BackColor = SystemColors.Highlight; dragWindow.Bounds = GetBounds(activeRange); dragWindow.ShowWindowTopMost(); val = this.grid.CurrentCell.Renderer.ControlValue; } } }
private void gridControl_CurrentCellValidated(object sender, EventArgs e) { var grid = (GridControl)sender; GridCurrentCell cc = grid.CurrentCell; var itemBeli = _listOfItemBeli[cc.RowIndex - 1]; var produk = itemBeli.Produk; if (produk != null) { switch (cc.ColIndex) { case 4: // kolom jumlah itemBeli.jumlah = NumberHelper.StringToDouble(cc.Renderer.ControlValue.ToString(), true); break; case 5: // dikson itemBeli.diskon = NumberHelper.StringToDouble(cc.Renderer.ControlValue.ToString(), true); break; case 6: // kolom harga itemBeli.harga = NumberHelper.StringToDouble(cc.Renderer.ControlValue.ToString(), true); break; default: break; } SetItemProduk(grid, cc.RowIndex, produk, itemBeli.jumlah, itemBeli.harga, itemBeli.diskon); grid.Refresh(); RefreshTotal(); } }
private void gridControl_CurrentCellValidated(object sender, EventArgs e) { var grid = (GridControl)sender; GridCurrentCell cc = grid.CurrentCell; var itemJual = _listOfItemJual[cc.RowIndex - 1]; var produk = itemJual.Produk; if (produk != null) { switch (cc.ColIndex) { case 4: // kolom jumlah itemJual.jumlah = Convert.ToDouble(cc.Renderer.ControlValue); break; case 5: // kolom diskon itemJual.diskon = Convert.ToDouble(cc.Renderer.ControlValue); break; case 6: // kolom harga itemJual.harga_jual = Convert.ToDouble(cc.Renderer.ControlValue); break; default: break; } SetItemProduk(grid, cc.RowIndex, cc.ColIndex, produk, itemJual.jumlah, itemJual.harga_jual, itemJual.diskon); grid.Refresh(); RefreshTotal(); } }
GridCurrentCell GetCurrentCell() { GridCurrentCell cc = null; if (this._grid.Parent is SplitterControl) { Control c = ((SplitterControl)this._grid.Parent).ActivePane; if (c is GridControlBase) { cc = ((GridControlBase)c).CurrentCell; } } if (cc == null) { if (this._grid.Model.ActiveGridView != null) { cc = this._grid.Model.ActiveGridView.CurrentCell; } if (cc == null) { cc = this._grid.CurrentCell; } } return(cc); }
private void grid_CurrentCellMoved(object sender, GridCurrentCellMovedEventArgs e) { GridCurrentCell cc = this.grid.CurrentCell; this.grid.RefreshRange(GridRangeInfo.Cell(0, cc.MoveFromColIndex)); this.grid.RefreshRange(GridRangeInfo.Cell(0, cc.MoveToColIndex)); this.grid.RefreshRange(GridRangeInfo.Row(cc.MoveToRowIndex)); this.grid.RefreshRange(GridRangeInfo.Row(cc.MoveFromRowIndex)); }
private void gridControl_CurrentCellValidated(object sender, EventArgs e) { var grid = (GridControl)sender; GridCurrentCell cc = grid.CurrentCell; Produk produk = null; ItemJualProduk itemJual = null; var rowIndex = cc.RowIndex - 1; if (_listOfItemJual.Count > rowIndex) { itemJual = _listOfItemJual[rowIndex]; produk = itemJual.Produk; } if (produk != null) { switch (cc.ColIndex) { case 4: // kolom keterangan itemJual.keterangan = cc.Renderer.ControlValue.ToString(); break; case 5: // kolom jumlah itemJual.jumlah = NumberHelper.StringToDouble(cc.Renderer.ControlValue.ToString(), true); itemJual.diskon = GetDiskonJualFix(produk, itemJual.jumlah, itemJual.diskon); itemJual.harga_jual = GetHargaJualFix(produk, itemJual.jumlah, itemJual.harga_jual); break; case 6: // kolom diskon itemJual.diskon = NumberHelper.StringToDouble(cc.Renderer.ControlValue.ToString(), true); break; case 7: // kolom harga itemJual.harga_jual = NumberHelper.StringToDouble(cc.Renderer.ControlValue.ToString(), true); break; default: break; } SetItemProduk(grid, cc.RowIndex, produk, itemJual.jumlah, itemJual.harga_jual, itemJual.diskon, itemJual.keterangan); grid.Refresh(); RefreshTotal(); if (cc.ColIndex == 5 || cc.ColIndex == 6 || cc.ColIndex == 7) { itemJual = _listOfItemJual[cc.RowIndex - 1]; DisplayItemProduct(itemJual); } } }
void tb_GotFocus(object sender, System.Windows.RoutedEventArgs e) { GridControlBase grid = lastGridWithFocus; if (grid != null) { GridCurrentCell cc = grid.CurrentCell; cc.BeginEdit(); } }
void tb_LostFocus(object sender, RoutedEventArgs e) { GridControlBase grid = lastGridWithFocus; if (grid != null) { GridCurrentCell cc = grid.CurrentCell; cc.EndEdit(); } }
string GetInfo(string name) { GridControl grid = this._splitter.ActivePane as GridControl; string s = ""; if (grid != null) { if (grid.CurrentCell.HasCurrentCell) { GridCurrentCell cc = grid.CurrentCell; GridCellRendererBase renderer = cc.Renderer; GridStyleInfo style = grid[cc.RowIndex, cc.ColIndex]; string ct = ""; if (renderer.HasControlText) { ct = " ControlText: " + renderer.ControlText; } string cv = ""; if (renderer.HasControlValue) { if (renderer.ControlValue != null) { ct = " ControlValue: " + renderer.ControlValue.ToString(); } else { ct = " ControlValue: null"; } } string st = style.Text; string sv = ""; if (style.CellValue != null) { sv = style.CellValue.ToString(); } s = string.Format("{0}{1} {2}\"{3}\", \"{4}\", StyleText: \"{5}\", StyleValue: \"{6}\" ", cc.IsModified ? "*" : "", name, grid.CurrentCell.RangeInfo, ct, cv, st, sv ); } else { s = name; } } return(s); }
void grid_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { GridControlBase grid = sender as GridControlBase; if (grid != null) { lastGridWithFocus = grid; GridCurrentCell cc = grid.CurrentCell; FormulaBox.Text = grid.Model[cc.CellRowColumnIndex.RowIndex, cc.CellRowColumnIndex.ColumnIndex].Text; } }
void grid_CurrentCellMoved(object sender, GridCurrentCellMovedEventArgs e) { inCurrentCellMoved = true; GridControlBase grid = sender as GridControlBase; if (grid != null) { lastGridWithFocus = grid; GridCurrentCell cc = grid.CurrentCell; FormulaBox.Text = grid.Model[cc.CellRowColumnIndex.RowIndex, cc.CellRowColumnIndex.ColumnIndex].Text; } inCurrentCellMoved = false; }
private void gridGroupingControl1_TableControlCurrentCellActivated(object sender, GridTableControlEventArgs e) { // Navigate to ExtraSection when textbox inside ExtraSection has become CurrentCell. GridCurrentCell gcc = e.TableControl.CurrentCell; GridTableCellStyleInfo style = e.TableControl.Model[gcc.RowIndex, gcc.ColIndex]; GridTableCellStyleInfoIdentity id = style.TableCellIdentity; if (id.DisplayElement is ExtraSection) { id.Table.CurrentRecordManager.NavigateTo(id.DisplayElement); } }
//set Highlight to the current row & column void TableControl_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e) { GridCurrentCell cc = gridGroupingControl1.TableControl.CurrentCell; GridControlBase grid = this.gridGroupingControl1.TableControl.CurrentCell.Grid; if (radioButton3.Checked) { // Highlight the current row with SystemColors.Highlight and bold font if (e.RowIndex > grid.Model.Cols.HeaderCount + 1 && e.ColIndex > grid.Model.Rows.HeaderCount && cc.HasCurrentCellAt(e.RowIndex)) { e.Style.Interior = new BrushInfo(SystemColors.Highlight); e.Style.TextColor = SystemColors.HighlightText; e.Style.Font.Bold = true; } } else if (radioButton2.Checked) { // Highlight the current cell with SystemColors.Highlight and bold font if (e.RowIndex > grid.Model.Cols.HeaderCount + 1 && e.ColIndex > grid.Model.Rows.HeaderCount && cc.HasCurrentCellAt(e.RowIndex, e.ColIndex)) { e.Style.Interior = new BrushInfo(SystemColors.Highlight); e.Style.TextColor = SystemColors.HighlightText; e.Style.Font.Bold = true; } } else if (radioButton4.Checked) { // Highlight the current column with SystemColors.Highlight and bold font if (e.RowIndex > grid.Model.Cols.HeaderCount + 1 && e.ColIndex > grid.Model.Rows.HeaderCount && cc.ColIndex == e.ColIndex) { e.Style.Interior = new BrushInfo(SystemColors.Highlight); e.Style.TextColor = SystemColors.HighlightText; e.Style.Font.Bold = true; } } else if (radioButton5.Checked) { // Highlight the current row & col with SystemColors.Highlight and bold font if (e.RowIndex > grid.Model.Cols.HeaderCount + 1 && e.ColIndex > grid.Model.Rows.HeaderCount && (cc.RowIndex == e.RowIndex || cc.ColIndex == e.ColIndex)) { e.Style.Interior = new BrushInfo(SystemColors.Highlight); e.Style.TextColor = SystemColors.HighlightText; e.Style.Font.Bold = true; } } }
private void gridControl_CurrentCellValidated(object sender, EventArgs e) { var grid = (GridControl)sender; GridCurrentCell cc = grid.CurrentCell; var itemPembayaran = _listOfItemPembayaranHutang[cc.RowIndex - 1]; var beli = itemPembayaran.BeliProduk; var isValidSisaNota = true; if (beli != null) { switch (cc.ColIndex) { case 5: // kolom pembayaran itemPembayaran.nominal = NumberHelper.StringToDouble(cc.Renderer.ControlValue.ToString()); beli.total_pelunasan = itemPembayaran.nominal + beli.total_pelunasan_old; isValidSisaNota = beli.sisa_nota >= 0; if (!isValidSisaNota) { beli.total_pelunasan -= itemPembayaran.nominal; MsgHelper.MsgWarning("Maaf, jumlah pembayaran melebihi sisa hutang"); GridListControlHelper.SetCurrentCell(grid, cc.RowIndex, cc.ColIndex); GridListControlHelper.SelectCellText(grid, cc.RowIndex, cc.ColIndex); break; } else { GridListControlHelper.SetCurrentCell(grid, cc.RowIndex, cc.ColIndex + 1); } break; case 6: // kolom keterangan itemPembayaran.keterangan = cc.Renderer.ControlValue.ToString(); break; default: break; } SetItemBayar(grid, cc.RowIndex, cc.ColIndex, beli, itemPembayaran.nominal, itemPembayaran.keterangan); grid.Refresh(); RefreshTotal(); } }
/// <summary> /// Make the image selection based on row index /// </summary> void Grid_Click(object sender, EventArgs e) { GridCurrentCell cc = this.grdDropDown.Grid.CurrentCell; if (this.grdDropDown.SelectedIndex != -1) { imageSelection(cc.RowIndex); } else { this.cboRule1ImageName.TextBox.Text = String.Empty; } this.cboRule1ImageName.PopupContainer.HidePopup(PopupCloseType.Done); }
/// <summary></summary> private void gdbVerses_CurrentCellValidating(object sender, System.ComponentModel.CancelEventArgs e) { GridCurrentCell cc = gdbVerses.CurrentCell; if (cc.ColIndex == 2) { // validate text if (gdbVerses[cc.RowIndex, cc.ColIndex].Text.IndexOfAny(new char[] { '<' }) != -1) { MessageBox.Show(this, "Verse contains an invalid character: <", "Invalid character"); e.Cancel = true; } } }
private void gridControl_CurrentCellKeyPress(object sender, KeyPressEventArgs e) { var grid = (GridControl)sender; GridCurrentCell cc = grid.CurrentCell; switch (cc.ColIndex) { case 5: // pembayaran e.Handled = KeyPressHelper.NumericOnly(e); break; default: break; } }
void grid_CurrentCellChanged(object sender, SyncfusionRoutedEventArgs args) { if (inTextChanged || inCurrentCellMoved) { return; } inCurrentCellChanged = true; GridControlBase grid = args.Source as GridControlBase; if (grid != null) { lastGridWithFocus = grid; GridCurrentCell cc = grid.CurrentCell; FormulaBox.Text = cc.Renderer.ControlText; } inCurrentCellChanged = false; }
public override void InvokeAction(object sender, EventArgs e) { if (this.ActiveGrid != null) { GridStyleInfo style = new GridStyleInfo(); GridCurrentCell cc = this.ActiveGrid.CurrentCell; if (this.ActiveGrid.Model[cc.RowIndex, cc.ColIndex].Font.Underline) { style.Font.Underline = false; } else { style.Font.Underline = true; } ApplyStyle(style); } }
private void gridControl_CurrentCellKeyPress(object sender, KeyPressEventArgs e) { var grid = (GridControl)sender; GridCurrentCell cc = grid.CurrentCell; // validasi input angka untuk kolom jumlah dan harga switch (cc.ColIndex) { case 4: // jumlah case 5: // harga e.Handled = KeyPressHelper.NumericOnly(e); break; default: break; } }
//used to setup the dropdown before it is shown. The RaiseCurrentCellShowingDropDown //code is commeted out as it requires teh 2.0 code base. This commented code allow //for an event that might cancel teh drop or set its size. public override void DropDownContainerShowingDropDown(object sender, CancelEventArgs e) { GridCurrentCell cc = this.Grid.CurrentCell; //// Size size = ddUser.Size; //// GridCurrentCellShowingDropDownEventArgs ce = new GridCurrentCellShowingDropDownEventArgs(size); //// Grid.RaiseCurrentCellShowingDropDown(ce); //// if (ce.Cancel) //// { //// e.Cancel = true; //// return; //// } //// ddUser.Size = ce.Size; /// this.DropDownContainer.Size = ddUser.Size; this.ddUser.SetValuesFromString(this.ControlText); ddUser.Visible = true; }
private void gridGroupingControl1_TableControlCellHitTest(object sender, GridTableControlCellHitTestEventArgs e) { gridGroupingControl1.TableModel.Options.SelectCellsMouseButtonsMask = MouseButtons.Left | MouseButtons.Right; if (e.Inner.MouseEventArgs.Button == System.Windows.Forms.MouseButtons.Right) { GridCurrentCell cc = e.TableControl.CurrentCell; GridTableCellStyleInfo style = e.TableControl.Model[e.Inner.RowIndex, e.Inner.ColIndex] as GridTableCellStyleInfo; SelectedRowForDT = (e.TableControl.TableDescriptor.ColIndexToField(e.Inner.RowIndex) - 2); SelectedColumForDT = e.TableControl.TableDescriptor.ColIndexToField(e.Inner.ColIndex); SelectedHeaderText = style.TableCellIdentity.Column.MappingName; contextMenuStrip1.Show(gridGroupingControl1, e.Inner.MouseEventArgs.X, e.Inner.MouseEventArgs.Y); } }
public void ApplyStyle(GridStyleInfo style, GridRangeInfoList ranges) { GridCurrentCell cc = this.CurrentCell; foreach (GridRangeInfo range in ranges) { GridRangeInfo cellRange = range.ExpandRange(1, 1, Model.RowCount, Model.ColumnCount); int row, col; if (cellRange.GetFirstCell(out row, out col)) { ModifyFontsAndOtherStyleProperties(style, Model[row, col]); while (cellRange.GetNextCell(ref row, ref col)) { ModifyFontsAndOtherStyleProperties(style, Model[row, col]); } Model.ResizeRowsToFit(range, GridResizeToFitOptions.NoShrinkSize); } } InvalidateCells(); }
private void gridControl_CurrentCellValidated(object sender, EventArgs e) { var grid = (GridControl)sender; GridCurrentCell cc = grid.CurrentCell; if (this._beli != null) { var obj = _listOfItemRetur[cc.RowIndex - 1]; var itemJual = this._beli.item_beli.Where(f => f.produk_id == obj.produk_id) .SingleOrDefault(); if (itemJual != null) { switch (cc.ColIndex) { case 4: if (_isValidJumlahRetur) { obj.jumlah_retur = NumberHelper.StringToDouble(cc.Renderer.ControlValue.ToString(), true); } break; case 5: obj.harga = NumberHelper.StringToDouble(cc.Renderer.ControlValue.ToString(), true); break; default: break; } SetItemProduk(grid, cc.RowIndex, itemJual, obj.jumlah_retur, obj.harga); grid.Refresh(); RefreshTotal(); } } }
void tb_TextChanged(object sender, TextChangedEventArgs e) { if (inCurrentCellChanged || inCurrentCellMoved) { return; } inTextChanged = true; GridControlBase grid = lastGridWithFocus; if (grid != null) { GridCurrentCell cc = grid.CurrentCell; if (grid.CurrentCell.HasCurrentCell) { cc.Renderer.SetControlText(FormulaBox.Text, false); } } inTextChanged = false; }
private void GGCVista_TableControlCheckBoxClick(object sender, GridTableControlCellClickEventArgs e) { GridCurrentCell cc = e.TableControl.CurrentCell; }
private void gridControl_CurrentCellKeyDown(object sender, KeyEventArgs e) { if (KeyPressHelper.IsEnter(e)) { var grid = (GridControl)sender; var rowIndex = grid.CurrentCell.RowIndex; var colIndex = grid.CurrentCell.ColIndex; JenisPengeluaran jenisPengeluaran = null; switch (colIndex) { case 2: // pencarian berdasarkan nama jenis pengeluaran GridCurrentCell cc = grid.CurrentCell; var namaProduk = cc.Renderer.ControlValue.ToString(); IJenisPengeluaranBll bll = new JenisPengeluaranBll(MainProgram.isUseWebAPI, MainProgram.baseUrl, _log); var listOfJenisPengeluaran = bll.GetByName(namaProduk); if (listOfJenisPengeluaran.Count == 0) { MsgHelper.MsgWarning("Data jenis pengeluaran tidak ditemukan"); GridListControlHelper.SelectCellText(grid, rowIndex, colIndex); } else if (listOfJenisPengeluaran.Count == 1) { jenisPengeluaran = listOfJenisPengeluaran[0]; if (!IsExist(jenisPengeluaran.jenis_pengeluaran_id)) { SetItemJenisPengeluaran(grid, rowIndex, colIndex, jenisPengeluaran); grid.Refresh(); RefreshTotal(); GridListControlHelper.SetCurrentCell(grid, rowIndex, colIndex + 1); } else { MsgHelper.MsgWarning("Data jenis pengeluaran sudah diinputkan"); GridListControlHelper.SetCurrentCell(grid, rowIndex, colIndex); } } else // data lebih dari satu, tampilkan form lookup { _rowIndex = rowIndex; _colIndex = colIndex; var frmLookup = new FrmLookupReferensi("Data Jenis Pengeluaran", listOfJenisPengeluaran); frmLookup.Listener = this; frmLookup.ShowDialog(); } break; case 3: GridListControlHelper.SetCurrentCell(grid, rowIndex, colIndex + 1); break; case 4: if (grid.RowCount == rowIndex) { _listOfItemPengeluaran.Add(new ItemPengeluaranBiaya()); grid.RowCount = _listOfItemPengeluaran.Count; } GridListControlHelper.SetCurrentCell(grid, rowIndex + 1, 2); // fokus ke kolom kode produk break; default: break; } } }
void calci_ValueCalculated(object sender, CalculatorValueCalculatedEventArgs arg) { GridCurrentCell cc = this.Grid.CurrentCell; this.Grid.Model[cc.RowIndex, cc.ColIndex].CellValue = this.calci.Value; }