Spread WinRT Documentation > Developer's Guide > Managing the User Interface > Resizing Rows and Columns |
You can allow the user to resize columns and rows or specific columns or rows. Multiple selected columns or rows can also be resized.
Move the mouse pointer over the border between the column or row header. The mouse pointer will change to a double arrow. Click and drag to the right or left to resize the column and row and release the mouse to change the column width or row height. A preview line is displayed when dragging.
You can make a column or row resizable in code with the SetColumnResizable or SetRowResizable method.
This example allows columns and rows to be resized.
CS |
Copy Code |
---|---|
private void Grid_Loaded_1(object sender, RoutedEventArgs e) { gcSpreadSheet1.Sheets[0].ColumnCount = 7; gcSpreadSheet1.Sheets[0].RowCount = 10; gcSpreadSheet1.Sheets[0].Cells[0, 0].Text = "Western"; gcSpreadSheet1.Sheets[0].Cells[0, 1].Text = "Western"; gcSpreadSheet1.Sheets[0].Cells[0, 2].Text = "Western"; gcSpreadSheet1.Sheets[0].Cells[1, 0].Text = "A"; gcSpreadSheet1.Sheets[0].Cells[1, 1].Text = "B"; gcSpreadSheet1.Sheets[0].Cells[1, 2].Text = "C"; gcSpreadSheet1.Sheets[0].SetColumnResizable(0, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader, true); gcSpreadSheet1.Sheets[0].SetRowResizable(0, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.RowHeader, true); } private void Button_Click_1(object sender, RoutedEventArgs e) { listBox1.Items.Add(gcSpreadSheet1.Sheets[0].GetColumnResizable(0).ToString()); //ListBox1.Items.Add(gcSpreadSheet1.Sheets[0].GetColumnResizable(0, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader).ToString()); //ListBox1.Items.Add(gcSpreadSheet1.Sheets[0].GetRowResizable(0).ToString()); listBox1.Items.Add(gcSpreadSheet1.Sheets[0].GetRowResizable(0, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.RowHeader).ToString()); } |
VB |
Copy Code |
---|---|
Private Sub MainPage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded gcSpreadSheet1.Sheets(0).ColumnCount = 7 gcSpreadSheet1.Sheets(0).RowCount = 10 gcSpreadSheet1.Sheets(0).Cells(0, 0).Text = "Western" gcSpreadSheet1.Sheets(0).Cells(0, 1).Text = "Western" gcSpreadSheet1.Sheets(0).Cells(0, 2).Text = "Western" gcSpreadSheet1.Sheets(0).Cells(1, 0).Text = "A" gcSpreadSheet1.Sheets(0).Cells(1, 1).Text = "B" gcSpreadSheet1.Sheets(0).Cells(1, 2).Text = "C" gcSpreadSheet1.Sheets(0).SetColumnResizable(0, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader, True) gcSpreadSheet1.Sheets(0).SetRowResizable(0, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.RowHeader, True) End Sub Private Sub Button_Click_1(sender As Object, e As RoutedEventArgs) ListBox1.Items.Add(gcSpreadSheet1.Sheets(0).GetColumnResizable(0).ToString()) 'ListBox1.Items.Add(GcSpreadSheet1.Sheets(0).GetColumnResizable(0, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader).ToString()) 'ListBox1.Items.Add(GcSpreadSheet1.Sheets(0).GetRowResizable(0).ToString()) ListBox1.Items.Add(gcSpreadSheet1.Sheets(0).GetRowResizable(0, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.RowHeader).ToString()) End Sub |