private void ApplyBaseCheck(GridStyleInfo style, CheckBox check, ColorPickerButton _color) { _color.BackColor = _color.SelectedColor; GridStyleInfo style1 = new GridStyleInfo(); if (check.Checked) { style.BackColor = _color.SelectedColor; style1.BaseStyle = "BackColorTest"; gridControl2.ChangeCells(GridRangeInfo.Cells(2, 1, 4, 4), style1); } else { style1.ResetBaseStyle(); gridControl2.ChangeCells(GridRangeInfo.Cells(2, 1, 4, 4), style1); } }
/// <summary> /// GridGrouping control getting started customization. /// </summary> private void GridSettings() { //used to set multiextended selection mode in gridgrouping control. this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended; this.gridGroupingControl1.TableOptions.GridVisualStyles = Syncfusion.Windows.Forms.GridVisualStyles.Metro; this.gridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails = false; this.gridGroupingControl1.TopLevelGroupOptions.ShowCaption = false; //used to set GridCaptionRowHeight. this.gridGroupingControl1.Table.DefaultCaptionRowHeight = 25; this.gridGroupingControl1.Table.DefaultColumnHeaderRowHeight = 30; this.gridGroupingControl1.Table.DefaultRecordRowHeight = 22; this.gridGroupingControl1.TableModel.ColWidths.ResizeToFit(GridRangeInfo.Table()); //Navigate to other control using tabkey navigation this.gridGroupingControl1.WantTabKey = false; }
private void DelayRefreshPropertyGrid(GridRangeInfo range, int interval) { if (refreshTimer != null) { refreshPropertyGridNextIdle = false; refreshTimer.Stop(); } else { refreshTimer = new Timer(); refreshTimer.Interval = interval; refreshTimer.Tick += new EventHandler(DelayedRefreshPropertyGrid); } refreshTimer.Start(); refreshPropertyGridNextIdle = true; this.range = range; }
private void Unmerge_Cells() { GridRangeInfo Range = cellGrid.SelectedRanges.ActiveRange; var rowcol = cellGrid.CurrentCell.CellRowColumnIndex; for (int row = Range.Top; row <= Range.Bottom; row++) { for (int col = Range.Left; col <= Range.Right; col++) { cellGrid.CoveredCells.Remove(cellGrid.CoveredCells.GetCoveredCell(row, col)); } } var style = cellGrid.Model[Range.Top, Range.Left]; style.HorizontalAlignment = HorizontalAlignment.Left; cellGrid.InvalidateCell(Range); }
private void MergeAcross_Click(object sender, RoutedEventArgs e) { if (cellGrid.SelectedRanges.Count < 1) { ShowErrorMessage("Please select any range"); return; } Unmerge_Cells(); GridRangeInfo Range = cellGrid.SelectedRanges.ActiveRange; int left = Range.Top, right = Range.Bottom; for (int i = Range.Top; i <= Range.Bottom; i++) { cellGrid.CoveredCells.Add(new CoveredCellInfo(i, Range.Left, i, Range.Right)); } cellGrid.InvalidateCell(Range); }
/// <summary> /// Expands all nodes in the wired grid. /// </summary> public void ExpandAll() { this.grid.TableControl.Parent.Cursor = Cursors.WaitCursor; this.grid.TableControl.BeginUpdate(); this.CollapseAll(); //speeds things up... int rowIndex = rowOffSet; while (rowIndex <= this.grid.TableControl.Model.RowCount) { ExpandNode(rowIndex, false, false); rowIndex += 1; } this.grid.TableControl.Model.ColWidths.ResizeToFit(GridRangeInfo.Col(TREECOLUMN), GridResizeToFitOptions.NoShrinkSize); this.grid.TableControl.EndUpdate(); this.grid.TableControl.Parent.Cursor = Cursors.Default; this.grid.TableControl.Refresh(); }
public void InitializeChartProperties(ChartControl chart, GridStyleInfo style) { chart.BeginUpdate(); //if(chart.Series.Count == 1) { GridRangeInfo range = this.cellvalueGridRangeInfo; chart.Series.Clear(); for (int i = 0; i < range.Width; i++) { ChartSeries series = new ChartSeries(string.Format("Team {0}", i + 1));//,csp.ChartType); //series = chart.Model.NewSeries(string.Format("Team {0}", i)); series.Text = series.Name; series.SeriesModel = new ChartGridSeriesModel(this.Grid, range, i); chart.Series.Add(series); } } ChartStyleProperties csp = new ChartStyleProperties(style); chart.Text = csp.TitleText; chart.TextAlignment = csp.TitleAlignment; //chart.TextPosition=csp.TitlePostion; chart.Palette = csp.ColorPalette; if (csp.ChartBackColor != Color.Transparent) { chart.BackColor = csp.ChartBackColor; } chart.ChartArea.BackInterior = csp.ChartAreaBackInterior; //chart.Legend.Visible=true; //chart.ShowLegend=csp.ShowLegend; //chart.LegendPosition=csp.LegendPosition; chart.Series3D = csp.Series3D; chart.PrimaryXAxis.DrawGrid = csp.XAxisGridLines; chart.PrimaryYAxis.DrawGrid = csp.YAxisGridLines; chart.PrimaryXAxis.Title = csp.XAxisTitle; chart.PrimaryYAxis.Title = csp.YAxisTitle; foreach (ChartSeries ss in chart.Series) { ss.Type = csp.ChartType; } chart.EndUpdate(); }
/// <summary> /// User has release mouse button. Stop automatic scrolling. /// </summary> /// <param name="e"></param> public void MouseUp(MouseEventArgs e) { // Stop automatic scrolling owner.AutoScrolling = ScrollBars.None; int rowIndex, colIndex; Point point = new Point(e.X, e.Y); owner.PointToRowCol(point, out rowIndex, out colIndex); dragWindow.Visible = false; dragWindow = null; GridRangeInfo range = GridRangeInfo.Cells(activeRange.Top, activeRange.Left, rowIndex, colIndex); MessageBox.Show(owner.Selections.Ranges.ActiveRange.ToString() + " expanded to " + range.ToString()); }
public override void MouseUp(MouseEventArgs e, GridCellHitTestInfo ht) { if (!MouseOverRange.IsEmpty) { MessageBox.Show("You dragged onto cell " + MouseOverRange.ToString()); } else { MessageBox.Show("Press this button and then drag over another cell " + MouseOverRange.ToString()); } base.MouseUp(e, ht); MouseOverRange = GridRangeInfo.Empty; Grid.AutoScrolling = ScrollBars.None; Grid.ScrollCellInView(ht.RowIndex, ht.ColIndex); _mouseDown = false; }
private void Model_QueryCellInfo(object sender, Syncfusion.UI.Xaml.CellGrid.Styles.GridQueryCellInfoEventArgs e) { if (e.Cell.RowIndex == 0 && e.Cell.ColumnIndex == 0) { return; } if (e.Cell.RowIndex == 0) { e.Style.CellValue = GridRangeInfo.GetAlphaLabel(e.Cell.ColumnIndex); e.Style.HorizontalAlignment = HorizontalAlignment.Center; } else if (e.Cell.ColumnIndex == 0) { e.Style.CellValue = e.Cell.RowIndex; e.Style.HorizontalAlignment = HorizontalAlignment.Center; } }
public void GridSettin(ChildForm childform) { childform.DG.TableDescriptor.VisibleColumns.Remove("Barcode"); childform.DG.TableDescriptor.VisibleColumns.Remove("ProductItemID"); childform.DG.TableDescriptor.VisibleColumns.Remove("AltBarcode"); childform.DG.TableDescriptor.VisibleColumns.Remove("Max"); childform.DG.TableDescriptor.VisibleColumns.Remove("Min"); childform.DG.TableDescriptor.VisibleColumns.Remove("ROP"); childform.DG.TableControl.CurrentCell.ShowErrorIcon = true; childform.DG.TableDescriptor.VisibleColumns.Remove("B3_1M"); childform.DG.TableDescriptor.VisibleColumns.Remove("B3_2M"); childform.DG.TableDescriptor.VisibleColumns.Remove("B3_3M"); childform.DG.TableDescriptor.VisibleColumns.Remove("B3_1M_D"); childform.DG.TableDescriptor.VisibleColumns.Remove("B3_2M_D"); childform.DG.TableDescriptor.VisibleColumns.Remove("B3_3M_D"); childform.DG.TableDescriptor.VisibleColumns.Add("ItemDescription"); childform.DG.TableDescriptor.VisibleColumns.Add("MOQ"); childform.DG.TableDescriptor.VisibleColumns.Add("Inventory"); childform.DG.TableDescriptor.VisibleColumns.Add("DOS"); childform.DG.TableDescriptor.VisibleColumns.Add("Sugg"); childform.DG.TableDescriptor.VisibleColumns.Add("FinalPC"); childform.DG.TableDescriptor.VisibleColumns.Add("OrderCTN"); childform.DG.TableDescriptor.VisibleColumns.Add("MOQUnit"); childform.DG.TableDescriptor.VisibleColumns.Add("Cost"); childform.DG.TableDescriptor.VisibleColumns.Add("Total"); childform.DG.TableDescriptor.VisibleColumns.Add("B1_1M"); childform.DG.TableDescriptor.VisibleColumns.Add("B1_2M"); childform.DG.TableDescriptor.VisibleColumns.Add("B1_3M"); childform.DG.TableDescriptor.VisibleColumns.Add("B2_1M"); childform.DG.TableDescriptor.VisibleColumns.Add("B2_2M"); childform.DG.TableDescriptor.VisibleColumns.Add("B2_3M"); childform.DG.TableDescriptor.VisibleColumns.Add("Total_1M"); childform.DG.TableDescriptor.VisibleColumns.Add("Total_2M"); childform.DG.TableDescriptor.VisibleColumns.Add("Total_3M"); childform.DG.TableDescriptor.VisibleColumns.Add("ShabanLY"); childform.DG.TableDescriptor.VisibleColumns.Add("RamazanLY"); childform.DG.Refresh(); childform.DG.Invalidate(); childform.DG.TableControl.RefreshRange(GridRangeInfo.Table()); }
/// <summary> /// Load the form for Setting the Grid /// </summary> void Form1_Load(object sender, EventArgs e) { grdDropDown.BeginUpdate(); grdDropDown.DataSource = CreateTable(); grdDropDown.DisplayMember = "Name"; grdDropDown.ValueMember = "Id"; grdDropDown.SelectionMode = SelectionMode.One; grdDropDown.ShowColumnHeader = false; grdDropDown.FillLastColumn = true; grdDropDown.BorderStyle = BorderStyle.FixedSingle; grdDropDown.ThemesEnabled = false; grdDropDown.Grid.VerticalThumbTrack = true; grdDropDown.Grid.DrawCellDisplayText += Grid_DrawCellDisplayText; grdDropDown.EndUpdate(); grdDropDown.Grid.QueryCellInfo += Grid_QueryCellInfo; DataTable dtRuleType = new DataTable(); dtRuleType.Columns.Add("RuleType"); dtRuleType.Rows.Add("Format all value cells based on their value range"); dtRuleType.Rows.Add("Format all value cells based on certain criteria"); dtRuleType.Rows.Add("Format top or bottom ranked value cells"); dtRuleType.Rows.Add("Format only value cells containing above or below average"); dtRuleType.Rows.Add("Format only unique or duplicate value cells"); grdRuleType.DataSource = dtRuleType; grdRuleType.DisplayMember = "RuleType"; grdRuleType.SelectionMode = SelectionMode.One; grdRuleType.ShowColumnHeader = false; grdRuleType.FillLastColumn = true; grdRuleType.BorderStyle = BorderStyle.FixedSingle; grdRuleType.ThemesEnabled = false; grdRuleType.Grid.VerticalThumbTrack = true; // default selection grdRuleType.Grid.Model.Selections.Add(GridRangeInfo.Cell(1, 1)); loadRule1Combobox(); imageSelection(5); cboRule2SummaryElement.SelectedIndex = 0; cboRule1ImageName.TextBox.Text = "3-Triangle"; ApplyConditionalFormat(); }
/// <summary> /// Grid Settings for better look and feel /// </summary> private void GridSettings() { this.gridControl1.RowCount = this.dataSet11.Customers.Rows.Count; this.gridControl1.ColCount = this.dataSet11.Customers.Columns.Count; this.gridControl1.PopulateValues(GridRangeInfo.Cells(1, 1, gridControl1.RowCount, gridControl1.ColCount), dataSet11.Customers); this.gridControl1.PopulateHeaders(GridRangeInfo.Cells(0, 1, 1, gridControl1.ColCount), dataSet11.Customers); this.gridControl1.ColWidths.ResizeToFit(GridRangeInfo.Cols(1, gridControl1.ColCount)); this.gridControl1.RowHeights.ResizeToFit(GridRangeInfo.Cols(1, gridControl1.RowCount)); this.gridControl1.BackColor = Color.White; this.gridControl1.AlphaBlendSelectionColor = Color.CornflowerBlue; this.gridControl1.GridVisualStyles = Syncfusion.Windows.Forms.GridVisualStyles.Metro; //Used to set default row height this.gridControl1.DefaultRowHeight = 22; this.gridControl1.Model.Options.DisplayEmptyColumns = true; this.gridControl1.Model.Options.DisplayEmptyRows = true; //tab key navigation set as false to move the next control this.gridControl1.WantTabKey = false; for (int i = 1; i < this.gridControl1.ColCount; i++) { Regex rex = new Regex(@"\p{Lu}"); string MappingName = this.gridControl1[0, i].Text; int index = rex.Match(MappingName.Substring(1)).Index; string name = ""; while (index > 0) { name += MappingName.Substring(0, index + 1) + " "; string secondName = MappingName.Substring(index + 1); index = rex.Match(secondName.Substring(1)).Index; while (index > 0) { name += secondName.Substring(0, index + 1) + " "; index = rex.Match(MappingName.Substring(name.Replace(" ", "").Length).Substring(1)).Index; } } name += MappingName.Substring(name.Replace(" ", "").Length); this.gridControl1[0, i].Text = name; } }
//FindAll - Loops through the cells in the grid and highlights all the values //that match with the given search string. private void btnFindAll_Click(object sender, EventArgs e) { if (cmbSearch.Text != null) { AddToSearchedList(cmbSearch.Text); SetOptions(); locInfo = GridRangeInfo.Table(); GridRangeInfo selRange = GridRangeInfo.Empty; int rowIndex, colIndex; if ((options & GridFindTextOptions.SelectionOnly) != GridFindTextOptions.None) { selRange = gridControl1.Selections.Ranges.ActiveRange; } else if ((options & GridFindTextOptions.ColumnOnly) != GridFindTextOptions.None) { selRange = GridRangeInfo.Col(gridControl1.CurrentCell.ColIndex); } else if ((options & GridFindTextOptions.WholeTable) != GridFindTextOptions.None) { selRange = GridRangeInfo.Cells(1, 1, gridControl1.RowCount, gridControl1.ColCount); } clearHighlight(); int startTop = selRange.Top; int startLeft = selRange.Left; do { GridStyleInfo style = gridControl1[startTop, startLeft]; GridCellRendererBase renderer = gridControl1.CellRenderers[style.CellType]; if (renderer.FindText(cmbSearch.Text, startTop, startLeft, options, true)) { gridControl1.CurrentCell.GetCurrentCell(out rowIndex, out colIndex); gridControl1[rowIndex, colIndex].BackColor = Color.Orange; } } while (GridFindReplaceDialogSink.GetNextCell(selRange, ref startTop, ref startLeft, false, chkSearchUp.Checked)); } this.highlighttext.HighlightText = ""; this.gridControl1.Refresh(); this.checkBox1.CheckState = CheckState.Unchecked; }
private void GridSettings() { gridControl1.ControllerOptions = GridControllerOptions.All & (~GridControllerOptions.OleDataSource); this.gridControl1.DefaultRowHeight = 18; this.gridControl1.DefaultColWidth = 100; this.gridControl1.DefaultGridBorderStyle = GridBorderStyle.None; this.gridControl1.Properties.RowHeaders = false; this.gridControl1.CellDoubleClick += new GridCellClickEventHandler(gridControl1_CellDoubleClick); this.gridControl1.ColWidths.ResizeToFit(GridRangeInfo.Table()); this.gridControl1.TableStyle.Trimming = StringTrimming.EllipsisCharacter; this.gridControl1.GridVisualStyles = Syncfusion.Windows.Forms.GridVisualStyles.Metro; this.gridControl1.ListBoxSelectionMode = SelectionMode.One; this.gridControl1.AllowProportionalColumnSizing = true; this.gridControl1.BrowseOnly = true; //tab key navigation set as false to move the next control this.gridControl1.WantTabKey = false; }
/// <summary> /// Setting GridGrouping control Properties /// </summary> private void GridSettings() { InitalizeGrid(); gridCtrl.InitializeCols(); gridCtrl.Grid.GridVisualStyles = GridVisualStyles.Metro; gridCtrl.Grid.TableStyle.WrapText = false; this.gridCtrl.Grid.ListBoxSelectionMode = SelectionMode.MultiExtended; //used to set GridCaptionRowHeight. this.gridCtrl.Grid.DefaultRowHeight = (int)DpiAware.LogicalToDeviceUnits(25.0f); this.gridCtrl.Grid.RowHeights[0] = (int)DpiAware.LogicalToDeviceUnits(30.0f); this.gridCtrl.Grid.RowHeights[1] = (int)DpiAware.LogicalToDeviceUnits(30.0f); this.gridCtrl.Grid.ColWidths.ResizeToFit(GridRangeInfo.Table()); //tab key navigation set as false to move the next control this.gridCtrl.Grid.WantTabKey = false; }
private void BuscarRucGrilla() { options = GridFindTextOptions.MatchWholeCell; options |= GridFindTextOptions.WholeTable; locInfo = GridRangeInfo.Table(); if (txtRuc.Text != "") { frEvents = new GridFindReplaceEventArgs(txtRuc.Text, "", options, locInfo); /*locInfo = GridRangeInfo.Table(); * * * frEvents = new GridFindReplaceEventArgs(txtSearch.Text, "", options, locInfo); * if (frDialog.Find(frEvents) == null) * MessageBox.Show("No Matches found for Text" + txtSearch.Text);*/ } }
private GridRangeInfo GetExpandedRange(GridRangeInfo range) { if (range.IsCols) { range = range.ExpandRange(range.Top + 1, range.Left, Model.RowCount, range.Left); } if (range.IsRows) { range = range.ExpandRange(range.Top, range.Left + 1, range.Top, Model.ColumnCount); } if (range.IsTable) { range = range.ExpandRange(range.Top + 1, range.Left + 1, Model.RowCount, Model.ColumnCount); } return(range); }
private void ClearSelectionAndSetCursor(bool setTextCursorToEndOfSelection) { TextBox gtb = grid.CurrentCell.Renderer.CurrentCellUIElement as TextBox; if (gtb != null) { if (setTextCursorToEndOfSelection) { gtb.SelectionStart += gtb.SelectionLength; gtb.SelectionLength = 0; } currentCellModified = true; GridRangeInfo range = selectedRange; selectedRange = GridRangeInfo.Empty; grid.InvalidateCell(range); gtb.Focus(); } }
/// <summary> /// A method that performs print operation. /// </summary> /// <param name="obj"></param> private void Print(object obj) { PivotGridControl pivotGrid1 = obj as PivotGridControl; // obj refers to PivotGridControl object Window printWindow = new Window(); if (pivotGrid1 != null) { pivotGrid1.InternalGrid.PrintRange = GridRangeInfo.Table(); PivotGridPrintDocument printDocument = new PivotGridPrintDocument(pivotGrid1); printDocument.Margin = new Thickness(20); PrintPreviewControl navigationControl = new PrintPreviewControl(printDocument); navigationControl.HeaderTemplate = this.HeaderTemplate; navigationControl.FooterTemplate = this.FooterTemplate; printWindow.Title = "Print Preview"; printWindow.Content = navigationControl; } printWindow.ShowDialog(); }
public override void InvokeAction(object sender, EventArgs e) { GridControlBase grid = ActiveGrid; if (grid != null) { GridRangeInfoList rl; if (grid.Selections.GetSelectedRanges(out rl, true)) { GridRangeInfo range = rl.ActiveRange; if (!range.IsEmpty) { range = grid.Model.CoveredRanges.Merge(range); } grid.Model.CoveredRanges.Remove(range); } } }
protected override void OnMouseHoverLeave(int rowIndex, int colIndex, EventArgs e) { Rectangle clRect = this.Grid.RangeInfoToRectangle(GridRangeInfo.Cell(rowIndex, colIndex)); Rectangle closeImage = new Rectangle(clRect.X + clRect.Width - 25, clRect.Y + 22, 21, 21); Rectangle flagImage = new Rectangle(clRect.X + clRect.Width - 50, clRect.Y + 2, 21, 21); using (Graphics g = this.Grid.CreateGridGraphics()) { if (moveRowIndex == rowIndex && moveColIndex == colIndex) { g.FillRectangle(Brushes.White, closeImage); g.FillRectangle(Brushes.White, flagImage); } g.Dispose(); } this.Grid.RefreshRange(GridRangeInfo.Cells(rowIndex, colIndex, rowIndex, colIndex)); base.OnMouseHoverLeave(rowIndex, colIndex, e); }
private void Button_Click(object sender, RoutedEventArgs e) { var currentSelectedRanges = grid.Model.SelectedRanges.Clone(); grid.Model.Selections.Clear(false); for (int i = 1; i <= grid.Model.RowCount; i++) { for (int j = 1; j <= grid.Model.ColumnCount; j++) { var cellRange = GridRangeInfo.Cell(i, j); if (!currentSelectedRanges.AnyRangeContains(cellRange)) { grid.Model.SelectedRanges.Add(cellRange); } } } grid.Model.InvalidateVisual(); }
private void GridSetting() { GridConditionalFormatDescriptor format1 = new GridConditionalFormatDescriptor(); format1.Appearance.AnyRecordFieldCell.TextColor = Color.Black; format1.Appearance.AnyRecordFieldCell.Interior = new BrushInfo(Color.LightGreen); format1.Expression = "[Status]='Sent' OR [Status]='SENT' "; DG2.TableDescriptor.ConditionalFormats.Add(format1); DG2.ThemesEnabled = false; DG2.Appearance.ColumnHeaderCell.Themed = false; DG2.Appearance.ColumnHeaderCell.Interior = new BrushInfo(GradientStyle.Vertical, Color.LightSkyBlue, Color.White); DG2.Appearance.ColumnHeaderCell.TextColor = Color.Black; DG2.TableDescriptor.VisibleColumns.Remove("VendorID"); DG2.TableDescriptor.Appearance.AnyCell.TextColor = Color.Black; DG2.TableDescriptor.Appearance.AnyRecordFieldCell.Font = new Syncfusion.Windows.Forms.Grid.GridFontInfo(new Font("Arial", 10f, FontStyle.Regular)); DG2.TableDescriptor.Columns["Vendor"].Appearance.AnyRecordFieldCell.HorizontalAlignment = GridHorizontalAlignment.Left; DG2.TableDescriptor.Columns["Vendor"].Appearance.AnyRecordFieldCell.WrapText = true; DG2.TableDescriptor.Columns["Vendor"].Width = 250; DG2.TableDescriptor.Columns["Email"].Width = 150; DG2.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails = false; DG2.TopLevelGroupOptions.ShowCaption = false; DG2.AllowProportionalColumnSizing = false; GridMetroColors colors = new GridMetroColors(); colors.PushButtonColor.NormalBackColor = Color.FromArgb(22, 165, 220); colors.PushButtonColor.HoverBackColor = Color.FromArgb(26, 198, 255); colors.PushButtonColor.PushedBackColor = Color.FromArgb(120, 191, 217); this.DG2.SetMetroStyle(colors); DG2.TableDescriptor.AllowNew = false; DG2.Refresh(); DG2.Invalidate(); DG2.TableControl.RefreshRange(GridRangeInfo.Table()); }
/// <summary> /// User has dragged mouse. If mouse is down, set current position. /// </summary> /// <param name="e"></param> public void MouseMove(MouseEventArgs e) { // Set current position int rowIndex, colIndex; Point point = new Point(e.X - delta, e.Y - delta); try { owner.PointToRowCol(point, out rowIndex, out colIndex, 0); rowIndex = Math.Max(owner.TopRowIndex, rowIndex); colIndex = Math.Max(owner.LeftColIndex, colIndex); GridRangeInfo range = GridRangeInfo.Cells(activeRange.Top, activeRange.Left, rowIndex, colIndex); dragWindow.Bounds = GetBounds(range); dragWindow.ShowWindowTopMost(); } catch { } }
private void Form1_Load(object sender, EventArgs e) { this.gridControl1.Model.PopulateValues(GridRangeInfo.Cells(1, 1, 15, 15), GetTable()); this.gridControl1.ColStyles[1].CellValueType = typeof(Int32); this.gridControl1.ColStyles[2].CellValueType = typeof(DateTime); this.gridControl1.ColCount = 3; this.gridControl1.RowCount = 16; //Error provider Properties this.gridControl1.ShowRowHeaderErroricon = false; this.gridControl1.CurrentCell.ShowErrorIcon = false; this.gridControl1.CurrentCell.ShowErrorMessageBox = false; this.gridControl1.CurrentCell.ValidationErrorText = string.Empty; textBox2.Enabled = false; textBox1.Enabled = false; this.gridControl1.CurrentCellValidating += new CancelEventHandler(gridControl1_CurrentCellValidating); this.gridControl1.CurrentCellErrorMessage += new GridCurrentCellErrorMessageEventHandler(gridControl1_CurrentCellErrorMessage); this.gridControl1.RefreshCurrentCellBehavior = GridRefreshCurrentCellBehavior.RefreshRow; this.gridControl1.KeyUp += new KeyEventHandler(gridControl1_KeyUp); }
/// <summary> /// Display the folder browser dialog. /// </summary> private void gridControl1_CellButtonClicked(object sender, GridCellButtonClickedEventArgs e) { GridRangeInfo rg = GridRangeInfo.Cell(e.RowIndex, e.ColIndex); if (e.ColIndex == 7) { MessageBox.Show("Clicked button at " + rg.ToString()); } if (e.ColIndex == 8) { DialogResult result = openFileDialog1.ShowDialog(); if (result == DialogResult.OK) { string file = openFileDialog1.FileName; try { setFile(file); } catch (IOException) { } } } if (e.ColIndex == 6) { DialogResult result = openFileDialog1.ShowDialog(); if (result == DialogResult.OK) { string file = openFileDialog1.FileName; try { MessageBox.Show("File is selected"); } catch (IOException) { } } } if (e.ColIndex == 4 && e.RowIndex == 6) { MessageBox.Show("Clicked Button: " + e.Button.Text + "\nRow Index: " + e.RowIndex + "\nColumn Index: " + e.ColIndex, "Click Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { if (e.Cell.RowIndex == 0 && e.Cell.ColumnIndex == 0) { return; } if (e.Cell.RowIndex == 0) { e.Style.CellValue = GridRangeInfo.GetAlphaLabel(e.Cell.ColumnIndex); e.Style.VerticalAlignment = VerticalAlignment.Center; e.Style.HorizontalAlignment = HorizontalAlignment.Center; } else if (e.Cell.ColumnIndex == 0) { e.Style.CellValue = e.Cell.RowIndex; e.Style.VerticalAlignment = VerticalAlignment.Center; e.Style.HorizontalAlignment = HorizontalAlignment.Center; } }
private void OnSourceListItemAdded(ListChangedEventArgs e) { //Console.WriteLine("OnSourceListItemAdded: {0} {1}", e.NewIndex, ((DataRowView) SourceList[e.NewIndex])[0]); int rowIndex = e.NewIndex + 1; BlinkQueueInsertRecord(e.NewIndex, null); Model.InsertRows(rowIndex, 1); //InsertDirtyCellRows(rowIndex, 1, null); // Generate missing ChangedFieldInfo objects PrepareItemAdded(SourceList[e.NewIndex]); Blink(e); object item = SourceList[e.NewIndex]; for (int n = 0; n < _pdc.Count; n++) { int columnIndex = n + 1; PropertyDescriptor pd = _pdc[n]; if (pd.PropertyType == typeof(double)) { object value = pd.GetValue(item); if (value != null && !(value is DBNull)) { _totals[n] += Convert.ToDouble(value); if (!_invalidateWholeSummaryRow) { InvalidateCell(new RowColumnIndex(SourceList.Count + 1, columnIndex)); } } } } if (_invalidateWholeSummaryRow) { InvalidateCell(GridRangeInfo.Row(SourceList.Count + 1)); } if (rowIndex < TopRowIndex) { VScrollBar.Value += RowHeights[rowIndex]; } InvalidateVisual(true); }
void formulaCombo_SelectedIndexChanged(object sender, EventArgs e) { XmlDocument xmldoc = new XmlDocument(); XmlNodeList xmlnode; int i = 0; string xmlText = File.ReadAllText(xmlfilePath); xmldoc.Load(xmlfilePath); xmlnode = xmldoc.GetElementsByTagName(this.formulaCombo.Text.ToString()); if (dbfunction.IndexOf(this.formulaCombo.Text) > -1) { this.gridControl1.PopulateHeaders(GridRangeInfo.Cells(0, 1, gridControl1.RowCount, gridControl1.ColCount), dbDT); this.gridControl1.PopulateValues(GridRangeInfo.Cells(1, 1, gridControl1.RowCount, gridControl1.ColCount), dbDT); } else { this.gridControl1.PopulateHeaders(GridRangeInfo.Cells(0, 1, gridControl1.RowCount, gridControl1.ColCount), dt); this.gridControl1.PopulateValues(GridRangeInfo.Cells(1, 1, gridControl1.RowCount, gridControl1.ColCount), dt); } try { if (xmlnode.Count == 1) { xmlnode[i].ChildNodes.Item(0).InnerText.Trim(); this.descrLable.Text = xmlnode[0].ChildNodes.Item(0).InnerText.Trim(); this.syntaxLable.Text = xmlnode[i].ChildNodes.Item(1).InnerText.Trim(); this.textBox1.Text = xmlnode[i].ChildNodes.Item(2).InnerText.Trim(); this.resultLable.Text = engine.ParseAndComputeFormula(this.textBox1.Text); } else { this.textBox1.Text = ""; this.descrLable.Text = "Not available"; this.syntaxLable.Text = "Not available"; this.resultLable.Text = ""; } } catch (Exception ex) { this.resultLable.Text = ex.Message; } }