private void onSelChangeGrid(object sender, SourceGrid.RangeRegionChangedEventArgs e) { try { SourceGrid.Selection.RowSelection select = sender as SourceGrid.Selection.RowSelection; SourceGrid.Grid g = select.Grid as SourceGrid.Grid; SourceGrid.RangeRegion region = g.Selection.GetSelectionRegion(); int[] indexes = region.GetRowsIndex(); if (indexes.Length < 1 || indexes[0] < 1) { _selectedAnalysis = null; } else { _selectedAnalysis = _analyses[indexes[0] - 1]; // analysis name/description if (null != _selectedAnalysis) { BoxProperties box = SelectedBox; PackProperties pack = _selectedAnalysis.Content as PackProperties; UpdateStatus(string.Empty); } } graphCtrlPack.Invalidate(); graphCtrlSolution.Invalidate(); } catch (Exception ex) { _log.Error(ex.Message); } }
private void OnSelChangeGrid(object sender, EventArgs e) { try { SourceGrid.Selection.RowSelection select = sender as SourceGrid.Selection.RowSelection; SourceGrid.Grid g = select.Grid as SourceGrid.Grid; SourceGrid.RangeRegion region = g.Selection.GetSelectionRegion(); int[] indexes = region.GetRowsIndex(); if (indexes.Length < 1 || indexes[0] < 1) { _selectedItem = null; } else { int iSel = indexes[0] - 1; if (g == gridPallets) { _selectedItem = _pallets[iSel]; } } graphCtrl.Invalidate(); } catch (Exception ex) { _log.Error(ex.Message); } }
/// <summary> /// Change current selection to sub script /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripButtonSubScript_Click(object sender, EventArgs e) { SourceGrid.RangeRegion region = grid1.Selection.GetSelectionRegion(); SourceGrid.PositionCollection poss = region.GetCellsPositions(); for (int i = 0; i < poss.Count; ++i) { getRichTextBoxCell(grid1, poss[i]).SelectionSubScript(); } }
public void GridCopySelectedToClipboard() { // Analyze selected range (rows/cols) SourceGrid.RangeRegion selRegion = grid1.Selection.GetSelectionRegion(); int[] selRows = selRegion.GetRowsIndex(); int[] selCols = selRegion.GetColumnsIndex(); Array.Sort(selRows); Array.Sort(selCols); GridCopyToClipboard(selRows, selCols); }
private int GetCurrentSolutionIndex() { SourceGrid.RangeRegion region = gridSolutions.Selection.GetSelectionRegion(); int[] indexes = region.GetRowsIndex(); // no selection -> exit if (indexes.Length == 0) { return(-1); } // return index return(indexes[0] - 1); }
private void onGridSolutionSelectionChanged(object sender, SourceGrid.RangeRegionChangedEventArgs e) { SourceGrid.RangeRegion region = gridSolutions.Selection.GetSelectionRegion(); int[] indexes = region.GetRowsIndex(); // no selection -> exit if (indexes.Length == 0) { return; } // redraw Draw(); }
private int CurrentRowIndex() { int rowIndex = -1; SourceGrid.RangeRegion selectedRegion = grdDetails.Selection.GetSelectionRegion(); if ((selectedRegion != null) && (selectedRegion.GetRowsIndex().Length > 0)) { rowIndex = selectedRegion.GetRowsIndex()[0]; } return(rowIndex); }
/// <summary> /// Underline current selection. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripButtonUnderline_Click(object sender, EventArgs e) { SourceGrid.RangeRegion region = grid1.Selection.GetSelectionRegion(); SourceGrid.PositionCollection poss = region.GetCellsPositions(); for (int i = 0; i < poss.Count; ++i) { SourceGrid.Cells.Cell cell = grid1.GetCell(poss[i]) as SourceGrid.Cells.Cell; if (cell != null) { getRichTextBoxCell(grid1, poss[i]).SelectionUnderline(); } } }
private CasePalletSolution GetCurrentSolution() { SourceGrid.RangeRegion region = gridSolutions.Selection.GetSelectionRegion(); int[] indexes = region.GetRowsIndex(); // no selection -> exit if (indexes.Length == 0) { return(null); } else { return(gridSolutions.Rows[indexes[0]].Tag as CasePalletSolution); } }
/// <summary> /// Align current selection to the right /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripButtonRight_Click(object sender, EventArgs e) { SourceGrid.RangeRegion region = grid1.Selection.GetSelectionRegion(); SourceGrid.PositionCollection poss = region.GetCellsPositions(); for (int i = 0; i < poss.Count; ++i) { SourceGrid.Cells.Cell cell = grid1.GetCell(poss[i]) as SourceGrid.Cells.Cell; if (cell != null) { cell.View.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; grid1.PerformLayout(); } } }
/// <summary> /// Change brackround color of current selection /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripButtonBackgroundColor_Click(object sender, EventArgs e) { SourceGrid.RangeRegion region = grid1.Selection.GetSelectionRegion(); SourceGrid.PositionCollection poss = region.GetCellsPositions(); for (int i = 0; i < poss.Count; ++i) { SourceGrid.Cells.Cell cell = grid1.GetCell(poss[i]) as SourceGrid.Cells.Cell; if (cell != null) { cell.View.BackColor = backgroundColor; grid1.PerformLayout(); } } }
private void onGridSolutionSelectionChanged(object sender, SourceGrid.RangeRegionChangedEventArgs e) { SourceGrid.RangeRegion region = gridSolutions.Selection.GetSelectionRegion(); int[] indexes = region.GetRowsIndex(); // no selection -> exit if (indexes.Length == 0) { return; } // get selected solution _sol = _analysis.Solutions[indexes[0] - 1]; // redraw graphCtrlCase.Invalidate(); graphCtrlPallet.Invalidate(); }
private void onGridSolutionSelectionChanged(object sender, SourceGrid.RangeRegionChangedEventArgs e) { SourceGrid.RangeRegion region = gridSolutions.Selection.GetSelectionRegion(); int[] indexes = region.GetRowsIndex(); // no selection -> exit if (indexes.Length == 0) { return; } // update select/unselect button text UpdateSelectButtonText(); // redraw graphCtrlCaseSolution.Invalidate(); graphCtrlPalletSolution.Invalidate(); }
void Selection_SelectionChanged(object sender, SourceGrid.RangeRegionChangedEventArgs e) { SourceGrid.RangeRegion region = gridSolutions.Selection.GetSelectionRegion(); int[] indexes = region.GetRowsIndex(); // no selection -> exit if (indexes.Length == 0) { return; } // redraw graphCtrlBoxesLayout.Invalidate(); graphCtrlPallet.Invalidate(); // update "Add solution" button status UpdateButtonAddSolutionStatus(); }
private void onGridSolutionSelectionChanged(object sender, SourceGrid.RangeRegionChangedEventArgs e) { SourceGrid.RangeRegion region = gridSolutions.Selection.GetSelectionRegion(); int[] indexes = region.GetRowsIndex(); // no selection -> exit if (indexes.Length == 0) { return; } // get selected solution _sol = _analysis.Solutions[indexes[0] - 1]; // update select/unselect button text UpdateSelectButtonText(); // redraw Draw(); }
void Selection_SelectionChanged(object sender, SourceGrid.RangeRegionChangedEventArgs e) { try { SourceGrid.RangeRegion region = gridSolutions.Selection.GetSelectionRegion(); int[] indexes = region.GetRowsIndex(); // no selection -> exit if (indexes.Length == 0) { return; } // redraw Draw(); // update "Add solution" button status UpdateToolbarButtons(); } catch (Exception ex) { _log.Error(ex.ToString()); } }
private void OnSelChangeGrid(object sender, SourceGrid.RangeRegionChangedEventArgs e) { try { SourceGrid.Selection.RowSelection select = sender as SourceGrid.Selection.RowSelection; SourceGrid.Grid g = select.Grid as SourceGrid.Grid; SourceGrid.RangeRegion region = g.Selection.GetSelectionRegion(); int[] indexes = region.GetRowsIndex(); if (indexes.Length < 1 || indexes[0] < 1) { _selectedAnalysis = null; } else { _selectedAnalysis = _analyses[indexes[0] - 1]; // analysis name/description if (null != _selectedAnalysis) { BoxProperties box = SelectedBox; PackProperties pack = _selectedAnalysis.Content as PackProperties; AnalysisName = string.Format("Analysis_{0}x{1}x{2}_{3}_on_{4}", pack.Dim0, pack.Dim1, pack.Dim2, box.Name, _selectedAnalysis.Container.Name); AnalysisDescription = string.Format("Packing {0}x{1}x{2} {3} on {4}", pack.Dim0, pack.Dim1, pack.Dim2, box.Name, _selectedAnalysis.Container.Name); UpdateStatus(string.Empty); } else { AnalysisName = string.Empty; AnalysisDescription = string.Empty; } } graphCtrlPack.Invalidate(); graphCtrlSolution.Invalidate(); } catch (Exception ex) { _log.Error(ex.Message); } }
private void onSelChangeGrid(object sender, SourceGrid.RangeRegionChangedEventArgs e) { try { SourceGrid.Selection.RowSelection select = sender as SourceGrid.Selection.RowSelection; SourceGrid.Grid g = select.Grid as SourceGrid.Grid; SourceGrid.RangeRegion region = g.Selection.GetSelectionRegion(); int[] indexes = region.GetRowsIndex(); if (indexes.Length < 1 || indexes[0] < 1) { _selectedAnalysis = null; } else { _selectedAnalysis = _analyses[indexes[0] - 1]; // analysis name/description if (null != _selectedAnalysis) { AnalysisName = string.Format("Analysis_{0}_in_{1}", _selectedAnalysis.Content.Name, _selectedAnalysis.Container.Name); AnalysisDescription = string.Format(" Packing {0} in {1}", _selectedAnalysis.Content.Name, _selectedAnalysis.Container.Name); } else { AnalysisName = string.Empty; AnalysisDescription = string.Empty; } } // update drawing graphCtrl.Invalidate(); } catch (Exception ex) { _log.Error(ex.Message); } }