public void ExecuteFontSizeCommand(int ActiveTabIndex, bool IsIncrement) { GridModel ActiveGridModel = GridModelCollection[ActiveTabIndex]; { if (ActiveGridModel != null && !ActiveGridModel.CurrentCellState.GridControl.CurrentCell.IsInMoveTo) { foreach (GridRangeInfo range in ActiveGridModel.SelectedRanges) { for (int row = range.Top; row <= range.Bottom; row++) { for (int col = range.Left; col <= range.Right; col++) { if (IsIncrement) { ActiveGridModel[row, col].Font.FontSize += 1; } else { ActiveGridModel[row, col].Font.FontSize -= 1; } } } ActiveGridModel.InvalidateCell(range); } } } }
public void CurrentCellStyleChanged(int ActiveTabIndex, string propertyName, object value) { GridModel ActiveGridModel = GridModelCollection[ActiveTabIndex]; if (ActiveGridModel != null && !ActiveGridModel.CurrentCellState.GridControl.CurrentCell.IsInMoveTo) { foreach (GridRangeInfo range in ActiveGridModel.SelectedRanges) { for (int row = range.Top; row <= range.Bottom; row++) { for (int col = range.Left; col <= range.Right; col++) { switch (propertyName) { case "FontFamily": ActiveGridModel[row, col].Font.FontFamily = (FontFamily)value; break; case "FontSize": ActiveGridModel[row, col].Font.FontSize = (double)value; break; case "FontWeight": ActiveGridModel[row, col].Font.FontWeight = (FontWeight)value; break; case "FontStyle": ActiveGridModel[row, col].Font.FontStyle = (FontStyle)value; break; case "TextDecorations": ActiveGridModel[row, col].Font.TextDecorations = (TextDecorationCollection)value; break; case "HorizontalAlignment": ActiveGridModel[row, col].HorizontalAlignment = (HorizontalAlignment)value; if ((HorizontalAlignment)value == HorizontalAlignment.Left) { ActiveGridModel[row, col].CellValue2 = ExcelHAlign.HAlignLeft; } break; case "VerticalAlignment": ActiveGridModel[row, col].VerticalAlignment = (VerticalAlignment)value; break; default: break; } } } ActiveGridModel.InvalidateCell(range); } } }