private void UpdateIsEnabled(CheckBoxCellView cell, CheckBoxCell checkBoxCell) { cell.Enabled = checkBoxCell.IsEnabled; if (cell.AccessoryView is ACheckBox aCheckBox) { aCheckBox.Enabled = checkBoxCell.IsEnabled; } }
public static void SwapRow(Worksheet Snatcheroo, CheckBoxCell CBC, int R) { int r = -1; int colMax = -1; GetActualizedRange(CW: Snatcheroo, maxRow: out r, maxCol: out colMax); SwapRow(Snatcheroo: Snatcheroo, CBC: CBC, R: R, r: r, colMax: colMax); }
private void UpdateIsEnabled(CellTableViewCell cell, CheckBoxCell checkBoxCell) { cell.UserInteractionEnabled = checkBoxCell.IsEnabled; cell.TextLabel.Enabled = checkBoxCell.IsEnabled; cell.DetailTextLabel.Enabled = checkBoxCell.IsEnabled; var bemCheckBox = cell.AccessoryView as BEMCheckBox; if (bemCheckBox != null) { bemCheckBox.Enabled = checkBoxCell.IsEnabled; } }
public static void SwapRow(Worksheet Snatcheroo, CheckBoxCell CBC, int R, int r, int colMax) { RangePosition RR = new RangePosition(row: R, col: 1, rows: 1, cols: colMax); Snatcheroo.InsertRows(row: R, count: 1); CellPosition cP = new CellPosition(row: R, col: 0); CopyRangeAction action0 = new unvell.ReoGrid.Actions.CopyRangeAction(fromRange: RR, toPosition: cP); DMT01.MainWindow.myReoGridControl_STATIC.DoAction(action0); RemoveRowsAction action1 = new unvell.ReoGrid.Actions.RemoveRowsAction(row: R, rows: 1); DMT01.MainWindow.myReoGridControl_STATIC.DoAction(action1); }
public void AddCheckedColumn(string caption, int width, bool autoSize = false) { var cell = new CheckBoxCell(Columns.Count); GridColumn column = new GridColumn(); column.HeaderText = caption; column.DataCell = cell; column.AutoSize = autoSize; column.Width = width; column.Editable = true; Columns.Add(column); fCheckedList = true; }
/// <summary> /// <see cref="CheckBoxCell"/>を返す /// </summary> /// <param name="align"></param> /// <param name="isBoolType">Bind するプロパティが bool の場合は true 通常は int なので、false</param> /// <returns></returns> public CheckBoxCell GetCheckBoxCell(ContentAlignment align = ContentAlignment.MiddleCenter, bool isBoolType = false) { var cell = new CheckBoxCell(); if (isBoolType) { cell.FalseValue = false; cell.TrueValue = true; } else { cell.FalseValue = 0; cell.TrueValue = 1; } cell.CheckAlign = align; cell.Style = GetDefaultCellStyle(MultiRowContentAlignment.MiddleLeft); return(cell); }
public void AddCheckedColumn(string caption, int width, bool autoSize = false) { //if (autoSize) width = -1; //Columns.Add(caption, width, HorizontalAlignment.Left); var cell = new CheckBoxCell(Columns.Count); GridColumn column = new GridColumn(); column.HeaderText = caption; column.DataCell = cell; column.AutoSize = autoSize; column.Width = width; column.Editable = true; Columns.Add(column); fCheckedList = true; }
private void OnCheckedChanged(int rowIndex, int cellIndex, int numberCellIndex) { var checkCell = new CheckBoxCell(); checkCell = (CheckBoxCell)grid.Rows[rowIndex].Cells[cellIndex]; var numberCell = new GcNumberCell(); numberCell = (GcNumberCell)grid.Rows[rowIndex].Cells[numberCellIndex]; bool checkValue = Convert.ToBoolean(checkCell.EditedFormattedValue); if (checkValue) { numberCell.Enabled = true; } else { numberCell.Enabled = false; } }
public void CheckboxEvent() { var checkbox = new CheckBoxCell(); worksheet["B1"] = checkbox; bool eventCheckChanged = false; checkbox.CheckChanged += (s, e) => eventCheckChanged = true; bool cellDataChanged = false; EventHandler <CellEventArgs> cellDataChangeHandler = (s, e) => cellDataChanged = true; worksheet.CellDataChanged += cellDataChangeHandler; worksheet["B1"] = true; worksheet.CellDataChanged -= cellDataChangeHandler; AssertTrue(eventCheckChanged, "CheckChanged"); AssertTrue(cellDataChanged, "CellDataChanged"); }
private void AddDemoSheet3() { /****************** Sheet3 : Built-in Cell Types ********************/ var worksheet = grid.NewWorksheet("Cell Types"); // set default sheet style worksheet.SetRangeStyles(RangePosition.EntireRange, new WorksheetRangeStyle { Flag = PlainStyleFlag.FontName | PlainStyleFlag.VerticalAlign, FontName = "Arial", VAlign = ReoGridVerAlign.Middle, }); worksheet.SetSettings(WorksheetSettings.View_ShowGridLine | WorksheetSettings.Edit_DragSelectionToMoveCells, false); worksheet.SelectionMode = WorksheetSelectionMode.Cell; worksheet.SelectionStyle = WorksheetSelectionStyle.FocusRect; var middleStyle = new WorksheetRangeStyle { Flag = PlainStyleFlag.Padding | PlainStyleFlag.HorizontalAlign, Padding = new PaddingValue(2), HAlign = ReoGridHorAlign.Center, }; var grayTextStyle = new WorksheetRangeStyle { Flag = PlainStyleFlag.TextColor, TextColor = Colors.DimGray }; worksheet.MergeRange(1, 1, 1, 6); worksheet.SetRangeStyles(1, 1, 1, 6, new WorksheetRangeStyle { Flag = PlainStyleFlag.TextColor | PlainStyleFlag.FontSize, TextColor = Colors.DarkGreen, FontSize = 18, }); worksheet[1, 1] = "Built-in Cell Bodies"; worksheet.SetColumnsWidth(1, 1, 100); worksheet.SetColumnsWidth(2, 1, 30); worksheet.SetColumnsWidth(3, 1, 100); worksheet.SetColumnsWidth(6, 2, 65); // button worksheet.MergeRange(3, 2, 1, 2); var btn = new ButtonCell("Hello"); worksheet[3, 1] = new object[] { "Button: ", btn }; btn.Click += (s, e) => ShowText(worksheet, "Button clicked."); // link worksheet.MergeRange(5, 2, 1, 3); var link = new HyperlinkCell("http://www.google.com"); worksheet[5, 1] = new object[] { "Hyperlink", link }; // checkbox var checkbox = new CheckBoxCell(); worksheet.SetRangeStyles(7, 2, 1, 1, middleStyle); worksheet.SetRangeStyles(8, 2, 1, 1, grayTextStyle); worksheet[7, 1] = new object[] { "Check box", checkbox, "Auto destroy after 5 minutes." }; worksheet[8, 2] = "(Keyboard is also supported to change the status of control)"; checkbox.CheckChanged += (s, e) => ShowText(worksheet, "Check box switch to " + checkbox.IsChecked.ToString()); // radio & radio group worksheet[10, 1] = "Radio Button"; worksheet.SetRangeStyles(10, 2, 3, 1, middleStyle); var radioGroup = new RadioButtonGroup(); worksheet[10, 2] = new object[, ] { { new RadioButtonCell() { RadioGroup = radioGroup }, "Apple" }, { new RadioButtonCell() { RadioGroup = radioGroup }, "Orange" }, { new RadioButtonCell() { RadioGroup = radioGroup }, "Banana" } }; radioGroup.RadioButtons.ForEach(rb => rb.CheckChanged += (s, e) => ShowText(worksheet, "Radio button selected: " + worksheet[rb.Cell.Row, rb.Cell.Column + 1])); worksheet[10, 2] = true; worksheet[13, 2] = "(By adding radio buttons into same RadioGroup to make them toggle each other automatically)"; worksheet.SetRangeStyles(13, 2, 1, 1, grayTextStyle); // dropdown - Not available yet - Planned from next version //worksheet.MergeRange(15, 2, 1, 3); //var dropdown = new DropdownListCell("Apple", "Orange", "Banana", "Pear", "Pumpkin", "Cherry", "Coconut"); //worksheet[15, 1] = new object[] { "Dropdown", dropdown }; //worksheet.SetRangeBorders(15, 2, 1, 3, BorderPositions.Outside, RangeBorderStyle.GraySolid); // custom cell type - slide cell body worksheet.MergeRange(15, 2, 1, 2); worksheet[15, 1] = new object[] { "Brightness", new SlideCellBody() }; worksheet[15, 2] = 1; worksheet.CellDataChanged += (s, e) => { if (e.Cell.Position == new CellPosition(15, 2)) { byte val = (byte)(worksheet.GetCellData <double>(e.Cell.Position) * 255); worksheet.SetRangeStyles(RangePosition.EntireRange, new WorksheetRangeStyle { Flag = PlainStyleFlag.BackColor, BackColor = new Graphics.SolidColor(val, val, val), }); } }; // image worksheet.MergeRange(2, 6, 5, 2); var image = new System.Windows.Media.Imaging.BitmapImage(); image.BeginInit(); using (MemoryStream memory = new MemoryStream(Properties.Resources.computer_laptop_png)) { image.StreamSource = memory; image.CacheOption = System.Windows.Media.Imaging.BitmapCacheOption.OnLoad; image.EndInit(); } worksheet[2, 6] = new ImageCell(image); // information cell worksheet.SetRangeBorders(19, 0, 1, 10, BorderPositions.Top, RangeBorderStyle.GraySolid); }
private void SetGridData() { var checkCell = new CheckBoxCell(); var textCellName = new GcTextBoxCell(); var numberCellOrder = new GcNumberCell(); var checkCellIndex = 0; var numberCellIndex = 2; var useContractNumber = UseLongTermAdvanceReceived && RegisterContractInAdvance; var tableName = InputGridTypeId == InputGridType.Billing ? nameof(Billing) : nameof(Receipt); var note1 = "備考1"; var note2 = "備考2"; var note3 = "備考3"; var note4 = "備考4"; foreach (var names in ColumnNameList.Where(x => x.TableName == tableName)) { if (names.ColumnName == "Note1") { note1 = names.DisplayColumnName; } if (names.ColumnName == "Note2") { note2 = names.DisplayColumnName; } if (names.ColumnName == "Note3") { note3 = names.DisplayColumnName; } if (names.ColumnName == "Note4") { note4 = names.DisplayColumnName; } } if (InputControlList.Count > 0) { foreach (var input in InputControlList) { if (input.ColumnName == "Note1") { input.ColumnNameJp = note1; } if (input.ColumnName == "Note2") { input.ColumnNameJp = note2; } if (input.ColumnName == "Note3") { input.ColumnNameJp = note3; } if (input.ColumnName == "Note4") { input.ColumnNameJp = note4; } } if (!UseDiscount && InputGridTypeId.Equals(InputGridType.Billing)) { var discountIndex = InputControlList.FindIndex( x => x.ColumnName.Equals(DiscountName) && x.ColumnNameJp.Equals(DiscountJpName)); InputControlList.RemoveAt(discountIndex); } if (!useContractNumber && InputGridTypeId.Equals(InputGridType.Billing)) { var contractIndex = InputControlList.FindIndex( x => x.ColumnName.Equals(ContractName) && x.ColumnNameJp.Equals(ContractJpName)); InputControlList.RemoveAt(contractIndex); } grid.RowCount = InputControlList.Count; for (var i = 0; i < InputControlList.Count; i++) { var inputControl = new InputControl(); inputControl = InputControlList[i]; checkCell = (CheckBoxCell)grid.Rows[i].Cells[0]; checkCell.Value = inputControl.TabStop; textCellName = (GcTextBoxCell)grid.Rows[i].Cells[1]; textCellName.Value = inputControl.ColumnNameJp; numberCellOrder = (GcNumberCell)grid.Rows[i].Cells[2]; numberCellOrder.Value = inputControl.TabIndex; OnCheckedChanged(i, checkCellIndex, numberCellIndex); } } else { var columnBillingName = new List <string> { nameof(Billing.SalesAt), nameof(Billing.BillingCategoryId), nameof(Billing.TaxClassId), nameof(Billing.DebitAccountTitleId), nameof(Billing.UseDiscount), nameof(Billing.Note1), nameof(Billing.ContractNumber), nameof(Billing.Quantity), nameof(Billing.UnitSymbol), nameof(Billing.UnitPrice), nameof(Billing.Price), nameof(Billing.TaxAmount), nameof(Billing.BillingAmount), }; var columnBillingNameJp = new List <string> { "売上日", "請求区分", "税区", "債権科目", "歩引計算", note1, "契約番号", "数量", "単位", "単価", "金額(抜)", "消費税", "請求額" }; var columnReceiptName = new List <string> { "ReceiptCategory", "Note1", "DueAt", "ReceiptAmount", "BillNumber", "BillBankCode", "BillBranchCode", "BillDrawAt", "BillDrawer", "Note2", "Note3", "Note4" }; var columnReceiptNameJp = new List <string> { "入金区分", note1, "期日", "金額", "手形番号", "銀行コード", "支店コード", "振出日", "振出人", note2, note3, note4 }; if (!UseDiscount && InputGridTypeId == InputGridType.Billing) { var nameIndex = columnBillingName.FindIndex(x => x.Equals(DiscountName)); var jpNameIndex = columnBillingNameJp.FindIndex(x => x.Equals(DiscountJpName)); columnBillingName.RemoveAt(nameIndex); columnBillingNameJp.RemoveAt(jpNameIndex); } if (!useContractNumber && InputGridTypeId == InputGridType.Billing) { var nameIndex = columnBillingName.FindIndex(x => x.Equals(ContractName)); var jpNameIndex = columnBillingNameJp.FindIndex(x => x.Equals(ContractJpName)); columnBillingName.RemoveAt(nameIndex); columnBillingNameJp.RemoveAt(jpNameIndex); } var columnName = InputGridTypeId == InputGridType.Billing ? columnBillingName : columnReceiptName; var columnNameJp = InputGridTypeId == InputGridType.Billing ? columnBillingNameJp : columnReceiptNameJp; grid.RowCount = columnName.Count; for (var i = 0; i < grid.RowCount; i++) { checkCell = (CheckBoxCell)grid.Rows[i].Cells[0]; checkCell.Value = true; textCellName = (GcTextBoxCell)grid.Rows[i].Cells[1]; textCellName.Value = columnNameJp[i]; numberCellOrder = (GcNumberCell)grid.Rows[i].Cells[2]; numberCellOrder.Value = i + 1; OnCheckedChanged(i, checkCellIndex, numberCellIndex); var inputControl = new InputControl(); inputControl.CompanyId = CompanyId; inputControl.LoginUserId = Login.UserId; inputControl.InputGridTypeId = InputGridTypeId; inputControl.ColumnName = columnName[i]; inputControl.ColumnNameJp = columnNameJp[i]; inputControl.ColumnOrder = i + 1; inputControl.TabIndex = i + 1; inputControl.TabStop = 1; InputControlList.Add(inputControl); } } }
public void Base64Load(string data) { var sheets = data.Split(';'); foreach (var sheetdata in sheets) { var nameAndSheet = sheetdata.Split(':'); var name = nameAndSheet[0]; var sheetbase64 = nameAndSheet[1]; var sheet = Grid.CreateWorksheet(name); var databytes = Convert.FromBase64String(sheetbase64); var xmltext = Encoding.UTF8.GetString(databytes); var xel = XElement.Parse(xmltext); AddWorksheetData(sheet, xdata => xdata.Xml = xel); var xml = new XmlDocument(); xml.LoadXml(xmltext); var origdecsep = xml["grid"]?["head"]?["meta"]?["decimalchar"]?.InnerText; if (origdecsep == null) { var origcultureid = xml["grid"]?["head"]?["meta"]?["culture"]?.InnerText ?? "en-US"; var origculture = new CultureInfo(origcultureid); origdecsep = origculture.NumberFormat.NumberDecimalSeparator; } ConvertCulture(xml, origdecsep); databytes = Encoding.UTF8.GetBytes(xml.InnerXml); var datastream = new MemoryStream(databytes); sheet.LoadRGF(datastream); Grid.AddWorksheet(sheet); var wsxd = _wsxdata[sheet]; foreach (var element in xel.XPathSelectElements("//cell[@body-type]")) { var btxattr = element.Attribute(XName.Get("body-type")); if (btxattr == null) { continue; } if (btxattr.Value.Equals("VerticalProgressCell")) { SetCellBodyFromXml(sheet, element, new VerticalProgressCell()); } if (btxattr.Value.Equals("HorizontalProgressCell")) { SetCellBodyFromXml(sheet, element, new HorizontalProgressCell()); } if (btxattr.Value.Equals("RadioButtonCell")) { var rc = ParseRowCol(element); var celldata = sheet.Cells[rc.r, rc.c].Data? .ToString() .Equals("True", StringComparison.InvariantCultureIgnoreCase) ?? false; var button = new RadioButtonCell { IsChecked = celldata }; var groupattr = element.Attribute(XName.Get("radio-group-range")); if (groupattr != null && RangePosition.IsValidAddress(groupattr.Value)) { var range = new RangePosition(groupattr.Value); if (wsxd.RadioGroups.ContainsKey(range)) { button.RadioGroup = wsxd.RadioGroups[range]; } else { var radiogroup = new RadioButtonGroup(); button.RadioGroup = radiogroup; wsxd.RadioGroups.Add(range, radiogroup); } } button.Click += (sender, eventArgs) => SaveChanges(); SetCellBodyFromXml(sheet, element, button); } if (btxattr.Value.Equals("CheckBoxCell")) { var rc = ParseRowCol(element); var celldata = sheet.Cells[rc.r, rc.c].Data? .ToString() .Equals("True", StringComparison.InvariantCultureIgnoreCase) ?? false; var button = new CheckBoxCell { IsChecked = celldata }; button.Click += (sender, eventArgs) => SaveChanges(); SetCellBodyFromXml(sheet, element, button); } if (btxattr.Value.Equals("DropdownListCell")) { var enumattr = element.Attribute(XName.Get("enum-name")); if (enumattr != null) { var rc = ParseRowCol(element); if (rc.r >= 0 && rc.c >= 0) { var button = new DropdownListCell(GetEnumEntries(enumattr.Value)); button.SelectedItemChanged += (sender, args) => SaveChanges(); sheet.Cells[rc.r, rc.c].Body = button; if (wsxd.EnumCells.ContainsKey(rc)) { wsxd.EnumCells[rc] = enumattr.Value; } else { wsxd.EnumCells.Add(rc, enumattr.Value); } } } } var formulael = element.Element(XName.Get("formula")); if (formulael != null) { var rc = ParseRowCol(element); if (rc.r >= 0 && rc.c >= 0) { sheet.SetCellFormula(rc.r, rc.c, formulael.Value); } } } } }
static void SwapRow(Worksheet Snatcheroo, CheckBoxCell CBC) { int R = CBC.Cell.Row; SwapRow(Snatcheroo, CBC, R); }
static public void SwapRow(CheckBoxCell CBC) { Worksheet Snatcheroo = CBC.Cell.Worksheet; SwapRow(Snatcheroo, CBC); }
public BuiltInCellTypesDemo() { InitializeComponent(); this.worksheet = grid.CurrentWorksheet; // ワークシート全体のスタイルを設定 worksheet.SetRangeStyles(RangePosition.EntireRange, new WorksheetRangeStyle { // フォント名と縦位置の揃え方を設定 Flag = PlainStyleFlag.FontName | PlainStyleFlag.VerticalAlign, FontName = "Arial", VAlign = ReoGridVerAlign.Middle, }); // グリッドラインを非表示 worksheet.SetSettings(WorksheetSettings.View_ShowGridLine | WorksheetSettings.Edit_DragSelectionToMoveCells, false); // 選択モードを単一セルのみに設定 worksheet.SelectionMode = WorksheetSelectionMode.Cell; // 選択スタイルを Focus に設定 worksheet.SelectionStyle = WorksheetSelectionStyle.FocusRect; var grayTextStyle = new WorksheetRangeStyle { Flag = PlainStyleFlag.TextColor, TextColor = Color.DimGray }; worksheet.MergeRange(1, 1, 1, 6); // B2:G2 worksheet.SetRangeStyles(1, 1, 1, 6, new WorksheetRangeStyle { Flag = PlainStyleFlag.TextColor | PlainStyleFlag.FontSize, TextColor = Color.DarkGreen, FontSize = 18, }); worksheet[1, 1] = "内蔵セル型"; // 列幅を調整 worksheet.SetColumnsWidth(1, 1, 100); worksheet.SetColumnsWidth(2, 1, 30); worksheet.SetColumnsWidth(3, 1, 100); worksheet.SetColumnsWidth(6, 2, 65); // ボタン worksheet.MergeRange(3, 2, 1, 2); // C4:D4 var btn = new ButtonCell("ボタン"); worksheet[3, 1] = new object[] { "ボタン: ", btn }; btn.Click += (s, e) => ShowText("ボタンがクリックされた。"); // リンク worksheet.MergeRange(5, 2, 1, 3); // C6:E6 var link = new HyperlinkCell("https://www.google.com") { AutoNavigate = false }; worksheet[5, 1] = new object[] { "ハイパーリンク", link }; link.Click += (s, e) => RGUtility.OpenFileOrLink(worksheet.GetCellText(5, 2)); // チェックボックス var checkbox = new CheckBoxCell(); worksheet.SetRangeStyles(8, 2, 1, 1, grayTextStyle); // C9:C9 worksheet[7, 1] = new object[] { "チェックボックス", checkbox, "テキストは別のセルを利用します" }; worksheet[8, 2] = "(セル型の編集はキーボードでも変更できます)"; checkbox.CheckChanged += (s, e) => ShowText("チェックステータスが変更された: " + checkbox.IsChecked.ToString()); // ラジオボタン worksheet[10, 1] = "Radio Button"; // B11 var radioGroup = new RadioButtonGroup(); // ラジオボタングループを作成 worksheet[10, 2] = new object[, ] { // C11 { new RadioButtonCell() { RadioGroup = radioGroup }, "リンゴ" }, { new RadioButtonCell() { RadioGroup = radioGroup }, "ミカン" }, { new RadioButtonCell() { RadioGroup = radioGroup }, "バナナ" } }; radioGroup.RadioButtons.ForEach(rb => rb.CheckChanged += (s, e) => ShowText("ラジオボタンのステータスが変更された:" + worksheet[rb.Cell.Row, rb.Cell.Column + 1])); worksheet[10, 2] = true; worksheet[13, 2] = "(RadioGroup に複数のラジオボタンを追加するとお互いに切り替えることができます)"; worksheet.SetRangeStyles(13, 2, 1, 1, grayTextStyle); //C14 // ドロップダウンリスト worksheet.MergeRange(15, 2, 1, 3); // C16:E16 var dropdown = new DropdownListCell("リンゴ", "ミカン", "バナナ", "ナシ", "カボチャ", "チェリー", "ココナッツ"); worksheet[15, 1] = new object[] { "ドロップダウン", dropdown }; worksheet.SetRangeBorders(15, 2, 1, 3, BorderPositions.Outside, RangeBorderStyle.GraySolid); dropdown.SelectedItemChanged += (s, e) => ShowText("ドロップダウンの項目が選択された:" + dropdown.SelectedItem); // イメージ worksheet.MergeRange(2, 6, 5, 2); // G3:H7 worksheet[2, 6] = new ImageCell(Resources.computer_laptop); // イベント情報 worksheet.SetRangeBorders("A20:J20", BorderPositions.Top, RangeBorderStyle.GraySolid); }
public BuiltInTypesDemo() { InitializeComponent(); this.worksheet = grid.CurrentWorksheet; // set default sheet style worksheet.SetRangeStyles(RangePosition.EntireRange, new WorksheetRangeStyle { Flag = PlainStyleFlag.FontName | PlainStyleFlag.VerticalAlign, FontName = "Arial", VAlign = ReoGridVerAlign.Middle, }); worksheet.SetSettings(WorksheetSettings.View_ShowGridLine | WorksheetSettings.Edit_DragSelectionToMoveCells, false); worksheet.SelectionMode = WorksheetSelectionMode.Cell; worksheet.SelectionStyle = WorksheetSelectionStyle.FocusRect; var middleStyle = new WorksheetRangeStyle { Flag = PlainStyleFlag.Padding | PlainStyleFlag.HorizontalAlign, Padding = new PaddingValue(2), HAlign = ReoGridHorAlign.Center, }; var grayTextStyle = new WorksheetRangeStyle { Flag = PlainStyleFlag.TextColor, TextColor = Color.DimGray }; worksheet.MergeRange(1, 1, 1, 6); worksheet.SetRangeStyles(1, 1, 1, 6, new WorksheetRangeStyle { Flag = PlainStyleFlag.TextColor | PlainStyleFlag.FontSize, TextColor = Color.DarkGreen, FontSize = 18, }); worksheet[1, 1] = "Built-in Cell Bodies"; worksheet.SetColumnsWidth(1, 1, 100); worksheet.SetColumnsWidth(2, 1, 30); worksheet.SetColumnsWidth(3, 1, 100); worksheet.SetColumnsWidth(6, 2, 65); // button worksheet.MergeRange(3, 2, 1, 2); var btn = new ButtonCell("Hello"); worksheet[3, 1] = new object[] { "Button: ", btn }; btn.Click += (s, e) => ShowText("Button clicked."); // link worksheet.MergeRange(5, 2, 1, 3); var link = new HyperlinkCell("http://www.google.com") { AutoNavigate = false }; worksheet[5, 1] = new object[] { "Hyperlink", link }; link.Click += (s, e) => System.Diagnostics.Process.Start(worksheet.GetCellText(5, 2)); // checkbox var checkbox = new CheckBoxCell(); worksheet.SetRangeStyles(7, 2, 1, 1, middleStyle); worksheet.SetRangeStyles(8, 2, 1, 1, grayTextStyle); worksheet[7, 1] = new object[] { "Check box", checkbox, "Auto destroy after 5 minutes." }; worksheet[8, 2] = "(Keyboard is also supported to change the status of control)"; checkbox.CheckChanged += (s, e) => ShowText("Check box switch to " + checkbox.IsChecked.ToString()); // radio & radio group worksheet[10, 1] = "Radio Button"; worksheet.SetRangeStyles(10, 2, 3, 1, middleStyle); var radioGroup = new RadioButtonGroup(); worksheet[10, 2] = new object[, ] { { new RadioButtonCell() { RadioGroup = radioGroup }, "Apple" }, { new RadioButtonCell() { RadioGroup = radioGroup }, "Orange" }, { new RadioButtonCell() { RadioGroup = radioGroup }, "Banana" } }; radioGroup.RadioButtons.ForEach(rb => rb.CheckChanged += (s, e) => ShowText("Radio button selected: " + worksheet[rb.Cell.Row, rb.Cell.Column + 1])); worksheet[10, 2] = true; worksheet[13, 2] = "(By adding radio buttons into same RadioGroup to make them toggle each other automatically)"; worksheet.SetRangeStyles(13, 2, 1, 1, grayTextStyle); // dropdown worksheet.MergeRange(15, 2, 1, 3); var dropdown = new DropdownListCell("Apple", "Orange", "Banana", "Pear", "Pumpkin", "Cherry", "Coconut"); worksheet[15, 1] = new object[] { "Dropdown", dropdown }; worksheet.SetRangeBorders(15, 2, 1, 3, BorderPositions.Outside, RangeBorderStyle.GraySolid); dropdown.SelectedItemChanged += (s, e) => ShowText("Dropdown list selected: " + dropdown.SelectedItem); // image worksheet.MergeRange(2, 6, 5, 2); worksheet[2, 6] = new ImageCell(Resources.computer_laptop); // information cell worksheet.SetRangeBorders(19, 0, 1, 10, BorderPositions.Top, RangeBorderStyle.GraySolid); }
private void CreateSheetControls() { var sheet = reoGridControl.CurrentWorksheet; // 自動付番ボタンを追加 var bangoButton = new ButtonCell("A"); bangoButton.Click += (s, _e) => sheet["F3"] = rand.Next(100000) + 100000; sheet["K3"] = bangoButton; // 性別選択ラジオボタンを作成 var seibetsuRadioButtonGroup = new RadioButtonGroup(); var seibetsuOtoko = new RadioButtonCell() { RadioGroup = seibetsuRadioButtonGroup }; var seibetsuOna = new RadioButtonCell() { RadioGroup = seibetsuRadioButtonGroup }; var seibetsuFumei = new RadioButtonCell() { RadioGroup = seibetsuRadioButtonGroup }; // ラジオボタンをワークシートに追加 sheet["O6"] = seibetsuOtoko; sheet["Q6"] = seibetsuOna; sheet["S6"] = seibetsuFumei; // 性別選択ラジオボタンを作成 var ketsuekiGataGroup = new RadioButtonGroup(); var ketsuekiA = new RadioButtonCell() { RadioGroup = ketsuekiGataGroup }; var ketsuekiB = new RadioButtonCell() { RadioGroup = ketsuekiGataGroup }; var ketsuekiO = new RadioButtonCell() { RadioGroup = ketsuekiGataGroup }; var ketsuekiAB = new RadioButtonCell() { RadioGroup = ketsuekiGataGroup }; var ketsuekiFumei = new RadioButtonCell() { RadioGroup = ketsuekiGataGroup }; // ラジオボタンをワークシートに追加 sheet["F7"] = ketsuekiA; sheet["I7"] = ketsuekiB; sheet["L7"] = ketsuekiO; sheet["O7"] = ketsuekiAB; sheet["R7"] = ketsuekiFumei; var kokugaiSumiCheck = new CheckBoxCell(); sheet["X11"] = kokugaiSumiCheck; // すべてのラジオボタンとチェックボックスのスタイルを設定 foreach (var cell in sheet.Ranges["F6:X11"].Cells) { if (cell.Body is RadioButtonCell || cell.Body is CheckBoxCell) { // 余白を設定 cell.Style.Padding = new PaddingValue(2); // 真ん中に寄せる cell.Style.HAlign = ReoGridHorAlign.Center; cell.Style.VAlign = ReoGridVerAlign.Middle; } } // 国籍リストを追加 var kokusekiList = new DropdownListCell("日本", "アメリカ", "イギリス", "ドイツ", "フランス", "イタリア", "中国"); sheet["O8"] = kokusekiList; // 郵便番号検索ボタンを追加 var yubinKensakuButton = new ButtonCell("検索"); sheet["P12"] = yubinKensakuButton; // 入社日・退社日のカレンダーボタンを作成 var calendarImage = Resources.Calendar_16; var nyusyaDay1Button = new ImageButtonCell(calendarImage); var taisyaDay1Button = new ImageButtonCell(calendarImage); var nyusyaDay2Button = new ImageButtonCell(calendarImage); var taisyaDay2Button = new ImageButtonCell(calendarImage); var nyusyaDay3Button = new ImageButtonCell(calendarImage); var taisyaDay3Button = new ImageButtonCell(calendarImage); // 入社日・退社日のカレンダーボタンをワークシートに追加 sheet["P18"] = nyusyaDay1Button; sheet["AA18"] = taisyaDay1Button; sheet["P21"] = nyusyaDay2Button; sheet["AA21"] = taisyaDay2Button; sheet["P24"] = nyusyaDay3Button; sheet["AA24"] = taisyaDay3Button; }
private GridView GenProgramType_GV() { var gd = new GridView(); gd.Bind(_ => _.DataStore, _vm, _ => _.GridViewDataCollection); gd.SelectedItemsChanged += (s, e) => { _vm.SelectedData = gd.SelectedItem as ProgramTypeViewData; }; gd.Height = 250; var nameTB = new TextBoxCell { Binding = Binding.Delegate <ProgramTypeViewData, string>(r => r.Name) }; gd.Columns.Add(new GridColumn { DataCell = nameTB, HeaderText = "Name", Sortable = true }); var peopleTB = new CheckBoxCell { Binding = Binding.Delegate <ProgramTypeViewData, bool?>(r => r.HasPeople) }; gd.Columns.Add(new GridColumn { DataCell = peopleTB, HeaderText = "People", Sortable = true }); var lightingTB = new CheckBoxCell { Binding = Binding.Delegate <ProgramTypeViewData, bool?>(r => r.HasLighting) }; gd.Columns.Add(new GridColumn { DataCell = lightingTB, HeaderText = "Lighting", Sortable = true }); var equipTB = new CheckBoxCell { Binding = Binding.Delegate <ProgramTypeViewData, bool?>(r => r.HasElecEquip) }; gd.Columns.Add(new GridColumn { DataCell = equipTB, HeaderText = "ElecEquip", Sortable = true }); var gasTB = new CheckBoxCell { Binding = Binding.Delegate <ProgramTypeViewData, bool?>(r => r.HasGasEquip) }; gd.Columns.Add(new GridColumn { DataCell = gasTB, HeaderText = "GasEquip", Sortable = true }); var infTB = new CheckBoxCell { Binding = Binding.Delegate <ProgramTypeViewData, bool?>(r => r.HasInfiltration) }; gd.Columns.Add(new GridColumn { DataCell = infTB, HeaderText = "Infiltration", Sortable = true }); var ventTB = new CheckBoxCell { Binding = Binding.Delegate <ProgramTypeViewData, bool?>(r => r.HasVentilation) }; gd.Columns.Add(new GridColumn { DataCell = ventTB, HeaderText = "Ventilation", Sortable = true }); var setpointTB = new CheckBoxCell { Binding = Binding.Delegate <ProgramTypeViewData, bool?>(r => r.HasSetpoint) }; gd.Columns.Add(new GridColumn { DataCell = setpointTB, HeaderText = "Setpoint", Sortable = true }); var serviceHotWaterTB = new CheckBoxCell { Binding = Binding.Delegate <ProgramTypeViewData, bool?>(r => r.HasServiceHotWater) }; gd.Columns.Add(new GridColumn { DataCell = serviceHotWaterTB, HeaderText = "ServiceHotWater", Sortable = true }); gd.Columns.Add(new GridColumn { DataCell = new CheckBoxCell { Binding = Binding.Delegate <ProgramTypeViewData, bool?>(r => r.Locked) }, HeaderText = "Locked", Sortable = true }); gd.Columns.Add(new GridColumn { DataCell = new TextBoxCell { Binding = Binding.Delegate <ProgramTypeViewData, string>(r => r.Source) }, HeaderText = "Source", Sortable = true }); // sorting by header gd.ColumnHeaderClick += OnColumnHeaderClick; return(gd); }