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 Button_Click(object sender, RoutedEventArgs e) { string outPut = ""; foreach (GridRangeInfo range1 in grid.Model.Selections.Ranges) { outPut += "===== " + range1.ToString() + Environment.NewLine; int row, col; int trackRow = -1; GridRangeInfo range = range1.ExpandRange(0, 0, grid.Model.RowCount, grid.Model.ColumnCount); if (range.GetFirstCell(out row, out col)) { // Console.Write("row{0},col{1} ", row, col); outPut += string.Format("row{0},col{1} ", row, col); trackRow = row; while (range.GetNextCell(ref row, ref col)) { if (row != trackRow) { trackRow = row; // Console.WriteLine(""); outPut += Environment.NewLine; } // Console.Write("row{0},col{1} ", row, col); outPut += string.Format("row{0},col{1} ", row, col); } // Console.WriteLine(""); outPut += Environment.NewLine; } outPut += Environment.NewLine; } this.textBox1.Text = outPut; // this.scrollViewer1.Content = outPut; }