private void init() { var sheet = reoGridControl2.CurrentWorksheet; sheet.CellMouseDown += sheet_CellMouseDown; sheet.SelectionRangeChanged += sheet_SelectionRangeChanged; sheet.FocusPosChanged += sheet_FocusPosChanged; var sheet2 = reoGridControl3.CurrentWorksheet; sheet2.Rows = 100; ButtonCell button = new ButtonCell(); button.Click += Button_Click; for (int i = 0; i < 100; i++) { if(sheet.ColumnHeaders[i]!=null) sheet.ColumnHeaders[i].Text = "VAR"; button = new ButtonCell(); button.Click += Button_Click; sheet2[i, 4] = button; sheet2[i, 4] = "..."; button = new ButtonCell(); button.Click += Missing_Click; sheet2[i, 3] = button; sheet2[i, 3] = "..."; Data.variableView[i].missing = new List<string>(); Data.variableView[i].missingRange = new List<string>(); } sheet.CellMouseDown += columnKeyDown; sheet.CellDataChanged += Sheet_CellDataChanged; sheet2.CellDataChanged += Sheet2_CellDataChanged1; sheet2.SetCols(5); sheet2.ColumnHeaders[0].Text = "Name"; sheet2.ColumnHeaders[1].Text = "Type"; sheet2.ColumnHeaders[2].Text = "Label"; sheet2.ColumnHeaders[3].Text = "Missing"; sheet2.ColumnHeaders[4].Text = "Values"; for(int i=0;i<Data.variableView.Count()-100;i++) { sheet2[i, 0] = Data.variableView[i].nama; sheet2[i, 1] = Data.variableView[i].type; sheet2[i, 2] = Data.variableView[i].label; // sheet2[i, 3] = Data.variableView[i].Decimal; sheet.ColumnHeaders[i].Text = Data.variableView[i].nama; } // sheet.ColumnHeaders[1].DefaultCellBody = typeof(unvell.ReoGrid.CellTypes.RadioButtonGroup); sheet2.CellDataChanged += Sheet2_CellDataChanged; sheet2.CellMouseDown += Sheet2_CellMouseDown; sheet2.SelectionRangeChanged += sheet2_SelectionRangeChanged; // sheet.SetRangeDataFormat(ReoGridRange.EntireRange, CellDataFormatFlag.Number, // new NumberDataFormatter.NumberFormatArgs() //{ // // decimal digit places 0.1234 // DecimalPlaces = 4, // // negative number style: (123) // NegativeStyle = NumberDataFormatter.NumberNegativeStyle.RedBrackets, // // use separator: 123,456 // UseSeparator = true, //}); }
public BuiltInTypesForm() { InitializeComponent(); // set grid cursor to windows default grid.SetRangeStyle(ReoGridRange.EntireRange, new ReoGridRangeStyle { Flag = PlainStyleFlag.FontName, FontName = "Arial", }); grid.CellsSelectionCursor = Cursors.Default; grid.SetSettings(ReoGridSettings.View_ShowGridLine, false); grid.SelectionMode = ReoGridSelectionMode.Cell; grid.SelectionStyle = ReoGridSelectionStyle.FocusRect; var middleStyle = new ReoGridRangeStyle { Flag = PlainStyleFlag.Padding | PlainStyleFlag.HorizontalAlign, Padding = new Padding(2), HAlign = ReoGridHorAlign.Center, }; var grayTextStyle = new ReoGridRangeStyle { Flag = PlainStyleFlag.TextColor, TextColor = Color.DimGray }; grid.MergeRange(1, 1, 1, 6); grid.SetRangeStyle(1, 1, 1, 6, new ReoGridRangeStyle { Flag = PlainStyleFlag.TextColor | PlainStyleFlag.FontSize, TextColor = Color.DarkGreen, FontSize = 18, }); grid[1, 1] = "Built-in Cell Bodies"; grid.SetColsWidth(1, 1, 100); grid.SetColsWidth(2, 1, 30); grid.SetColsWidth(3, 1, 100); grid.SetColsWidth(6, 2, 65); // button grid.MergeRange(3, 2, 1, 2); var btn = new ButtonCell("Hello"); grid[3, 1] = new object[] { "Button: ", btn }; btn.Click += (s, e) => ShowText("Button clicked."); // link grid.MergeRange(5, 2, 1, 2); var link = new HyperlinkCell("http://www.google.com"); grid[5, 1] = new object[] { "Hyperlink", link }; link.Click += (s, e) => System.Diagnostics.Process.Start(grid.GetCellText(5, 2)); // checkbox var checkbox = new CheckBoxCell(); grid.SetRangeStyle(7, 2, 1, 1, middleStyle); grid.SetRangeStyle(8, 2, 1, 1, grayTextStyle); grid[7, 1] = new object[] { "Check box", checkbox, "Auto destroy after 5 minutes." }; grid[8, 2] = "(Keyboard is also supported to change the status of control)"; checkbox.CheckChanged += (s, e) => ShowText("Check box switch to " + checkbox.ButtonState.ToString()); // radio & radio group grid[10, 1] = "Radio Button"; grid.SetRangeStyle(10, 2, 3, 1, middleStyle); var radioGroup = new RadioButtonGroup(); grid[10, 2] = new object[,] { {new RadioButtonCell() { RadioGroup = radioGroup }, "Apple"}, {new RadioButtonCell() { RadioGroup = radioGroup }, "Orange"}, {new RadioButtonCell() { RadioGroup = radioGroup }, "Banana"} }; grid[13, 2] = "(By adding into RadioGroup will make it toggled automatically)"; grid.SetRangeStyle(13, 2, 1, 1, grayTextStyle); // dropdown grid.MergeRange(15, 2, 1, 3); var dropdown = new DropdownCell(new object[] { "Apple", "Orange", "Banana", "Pear", "Pumpkin", "Cherry", "Coconut" }); grid[15, 1] = new object[] { "Dropdown", dropdown }; grid.SetRangeBorder(15, 2, 1, 3, ReoGridBorderPos.Outline, ReoGridBorderStyle.SolidGray); // image grid.MergeRange(2, 6, 5, 2); grid[2, 6] = new ImageCell(Resources.computer_laptop); // information cell grid.SetRangeBorder(19, 0, 1, 10, ReoGridBorderPos.Top, ReoGridBorderStyle.SolidGray); }