public EasyGridRadioButtonCollection(EasyGridRadioButtonCell parent) { _parent = parent; _radioButtons = new List <RadioButton>(); _count++; RefCount = _count; }
public EasyGridRadioButtonColumn(EasyGridRadioButtonCell cellTemplate, EasyGridViewParent parent) : base(cellTemplate) { _headerCell = new EasyGridHeaderCell(base.HeaderCell); _columnSpan = new ColumnSpan(this); _dataGridView = parent; }
public CellRadioButtonSelectedEventArgs(int index, int row, int col, String text, EasyGridRadioButtonCell cell) { SelectedIndex = index; RowIndex = row; ColIndex = col; Text = text; Cell = cell; }
public EasyGridRadioButtonColumn(EasyGridRadioButtonCell cellTemplate) : base(cellTemplate) { }
//public IEasyGridCell getVariousCell(EasyGridVariousTypeCellInfo info, String tooltip = null) public IEasyGridCell SetVariousCell(EasyGridCellInfo info, String tooltip = null) { IEasyGridCell cell; ItemTypes itemType = info.ItemType; #region TextBox if (itemType == ItemTypes.TextBox) { cell = new EasyGridTextBoxCell(_view.ListView as EasyGridViewParent); (cell as EasyGridTextBoxCell).SetValue(info);//.Value = info;//.Text; } #endregion #region FileOpenBox else if (itemType == ItemTypes.FileOpenBox) { cell = new EasyGridFileOpenBoxCell(_view.ListView as EasyGridViewParent); (cell as EasyGridFileOpenBoxCell).SetValue(info);//.Value = info;//.Text; } #endregion #region KeyValue else if (itemType == ItemTypes.KeyValue) { cell = new EasyGridKeyValueCell(_view.ListView); cell.SetValue(info); } #endregion #region CheckBox else if (itemType == ItemTypes.CheckBox) { cell = new EasyGridCheckBoxCell(_view.ListView); cell.SetValue(info); } #endregion #region ImageCheckBox else if (itemType == ItemTypes.ImageCheckBox) { cell = new EasyGridImageCheckBoxCell(); cell.SetValue(info); } #endregion #region ComboBox else if (itemType == ItemTypes.ComboBox) { cell = new EasyGridComboBoxCell(_view.ListView); cell.SetValue(info); } #endregion #region RadioButton else if (itemType == ItemTypes.RadioButton) { cell = new EasyGridRadioButtonCell(_view.ListView); cell.SetValue(info); } #endregion #region CheckBoxGroup else if (itemType == ItemTypes.CheckBoxGroup) { cell = new EasyGridCheckBoxGroupCell(_view.ListView); cell.SetValue(info); } #endregion #region Button else if (itemType == ItemTypes.Button) { cell = new EasyGridButtonCell(_view.ListView); cell.SetValue(info); } #endregion #region CloseButton else if (itemType == ItemTypes.CloseButton) { cell = new EasyGridCloseButtonCell(_view.ListView); cell.SetValue(info); } #endregion #region Image else if (itemType == ItemTypes.Image) { cell = new EasyGridImageCell(_view.ListView); cell.SetValue(info); } #endregion #region ImageButton else if (itemType == ItemTypes.ImageButton) { cell = new EasyGridImageButtonCell(_view.ListView); if (info.Images == null) { IEasyGridColumn col = _view.Column(this.Cells.Count); if (col is EasyGridImageButtonColumn) { info.Images = (col as EasyGridImageButtonColumn).Images; } else if (col is EasyGridImageColumn) { info.Images = (col as EasyGridImageColumn).Images; } cell.SetValue(info); } else { cell.SetValue(info); } } #endregion else//default { cell = new EasyGridTextBoxCell(_view.ListView as EasyGridViewParent); cell.SetValue(info); } return(cell); }
/// <summary> /// 대상 row에 cell을 추가합니다. 주로 새로이 row를 만들어 추가할 때 사용됩니다. /// </summary> /// <param name="row">대상이 되는 DataGridViewRow</param> /// <param name="value">넣어 줄 값</param> public void AddItemInRow(DataGridViewRow row, object value, String tooltip = null) { int colIndex = row.Cells.Count; ItemTypes itemType = (_view.ListView.Columns[colIndex] as IEasyGridColumn).ItemType;// _itemTypes[colIndex]; IEasyGridCell cell; #region TextBox if (itemType == ItemTypes.TextBox) { cell = new EasyGridTextBoxCell(_view.ListView as EasyGridViewParent); EasyGridTextBoxCell myCell = cell as EasyGridTextBoxCell; EasyGridTextBoxColumn col = _view.ListView.Columns[colIndex] as EasyGridTextBoxColumn; if (value == null) { myCell.Value = ""; } else { if ((value is EasyGridCellInfo) == false) { myCell.IsEditable = col.IsEditable; if (col.CellTextAlignMode == TextAlignModes.None) { myCell.TextAlignMode = _view.TextAlignMode; } else { myCell.TextAlignMode = col.CellTextAlignMode; } if (col.TextViewMode == TextViewModes.Default) { myCell.TextViewMode = _view.TextViewMode; } else { myCell.TextViewMode = col.TextViewMode; } } (cell as EasyGridTextBoxCell).Value = value.ToString(); } } #endregion #region FileOPen else if (itemType == ItemTypes.FileOpenBox) { cell = new EasyGridFileOpenBoxCell(_view.ListView as EasyGridViewParent); EasyGridFileOpenBoxCell myCell = cell as EasyGridFileOpenBoxCell; EasyGridFileOpenBoxColumn col = _view.ListView.Columns[colIndex] as EasyGridFileOpenBoxColumn; if (value == null) { myCell.Value = ""; } else { if ((value is EasyGridCellInfo) == false) { myCell.IsEditable = col.IsEditable; myCell.TextAlignMode = col.CellTextAlignMode; } (cell as EasyGridFileOpenBoxCell).Value = value.ToString(); } } #endregion #region KeyValue else if (itemType == ItemTypes.KeyValue) { cell = new EasyGridKeyValueCell(_view.ListView); EasyGridKeyValueCell myCell = cell as EasyGridKeyValueCell; if (value == null) { myCell.Value = ""; } else { myCell.Value = value; } } #endregion #region CheckBox else if (itemType == ItemTypes.CheckBox) { cell = new EasyGridCheckBoxCell(_view.ListView); EasyGridCheckBoxCell myCell = cell as EasyGridCheckBoxCell; if (value == null) { myCell.Value = false; } else { myCell.Value = value; } } #endregion #region ImageCheckBox else if (itemType == ItemTypes.ImageCheckBox) { cell = new EasyGridImageCheckBoxCell(); EasyGridImageCheckBoxCell myCell = cell as EasyGridImageCheckBoxCell; EasyGridImageColumn col = _view.ListView.Columns[colIndex] as EasyGridImageColumn; if (col != null && col.Images != null && col.Images.Count > 0) { ICollection <Image> imageList = col.Images;// _titleInitData[colIndex] as ICollection<Image>; if (imageList.Count != 0) { myCell.Images = imageList; } } if (value == null) { myCell.Value = 0; } else if (value is string) { int intval; if (int.TryParse(value as String, out intval)) { myCell.Value = intval; } else { myCell.Value = 0; } } else { myCell.Value = value; } } #endregion #region ComboBox else if (itemType == ItemTypes.ComboBox) { cell = new EasyGridComboBoxCell(_view.ListView); //ContextMenuStrip menu = cell.ContextMenuStrip; EasyGridComboBoxCell myCell = cell as EasyGridComboBoxCell; EasyGridComboBoxColumn col = _view.ListView.Columns[colIndex] as EasyGridComboBoxColumn; if (myCell.Items == null || myCell.Items.Count == 0) { if (col.Items != null && col.Items.Count > 0) { myCell.Items = col.Items; myCell.SelectedIndex = col.SelectedIndex; } } /* * if (_titleInitData[colIndex] != null && _titleInitData[colIndex] is ICollection<String>) * { * if (myCell.Items.Count == 0) myCell.Items = _titleInitData[colIndex] as ICollection<String>; * } * EasyGridComboBoxColumn col = _view.ListView.Columns[colIndex] as EasyGridComboBoxColumn; */ if (value == null) { myCell.Value = -1; } else if (value is string) { int intval; if (int.TryParse(value as String, out intval)) { myCell.Value = intval; } else if (col.Items != null && col.Items.Count > 0 && col.Items.Contains(value as string)) { myCell.Value = col.Items.ToList().IndexOf(value as string); } else { myCell.Value = -1; } } else { myCell.Value = value; } } #endregion #region RadioButton else if (itemType == ItemTypes.RadioButton) { cell = new EasyGridRadioButtonCell(_view.ListView); //ContextMenuStrip menu = cell.ContextMenuStrip; EasyGridRadioButtonCell myCell = cell as EasyGridRadioButtonCell; EasyGridRadioButtonColumn col = _view.ListView.Columns[colIndex] as EasyGridRadioButtonColumn; if (myCell.Items == null || myCell.Items.Count == 0) { if (col.Items != null && col.Items.Count > 0) { myCell.Items.Add(col.Items); myCell.SelectedIndex = col.SelectedIndex; } } /* * if (_titleInitData[colIndex] != null && _titleInitData[colIndex] is ICollection<String>) * { * if (cCell.Items.Count == 0) cCell.Items.Add(_titleInitData[colIndex] as ICollection<String>); * } * int refCount = cCell.Items.RefCount; */ if (value == null) { myCell.Value = myCell.StartIndex; } else if (value is string) { int intval; if (int.TryParse(value as String, out intval)) { myCell.Value = intval; } else { myCell.Value = myCell.StartIndex; } } else { myCell.Value = value; } } #endregion #region CheckBoxGroup else if (itemType == ItemTypes.CheckBoxGroup) { cell = new EasyGridCheckBoxGroupCell(_view.ListView); //ContextMenuStrip menu = cell.ContextMenuStrip; EasyGridCheckBoxGroupCell myCell = cell as EasyGridCheckBoxGroupCell; EasyGridCheckBoxGroupColumn col = _view.ListView.Columns[colIndex] as EasyGridCheckBoxGroupColumn; if (myCell.Items == null || myCell.Items.Count == 0) { if (col.Items != null && col.Items.Count > 0) { myCell.Items.Add(col.Items); if (col.Items.Count > 0) { myCell.SetValue(col.Items.GetValue()); } } } /* * if (_titleInitData[colIndex] != null && _titleInitData[colIndex] is ICollection<String>) * { * if(cCell.Items.Count == 0) cCell.Items.Add(_titleInitData[colIndex] as ICollection<String>); * } */ if (value == null) { //myCell.Value = ""; } else if (value is string) { int intval; if (int.TryParse(value as String, out intval)) { myCell.Value = intval; } else { myCell.Value = value; } } else { myCell.Value = value; } } #endregion #region Button else if (itemType == ItemTypes.Button) { cell = new EasyGridButtonCell(_view.ListView); EasyGridButtonCell myCell = cell as EasyGridButtonCell; EasyGridButtonColumn col = _view.ListView.Columns[colIndex] as EasyGridButtonColumn; myCell.BaseText = col.Text; if (value == null) { myCell.Value = col.Text; } else { myCell.Value = value; } } #endregion #region CloseButton else if (itemType == ItemTypes.CloseButton) { cell = new EasyGridCloseButtonCell(_view.ListView); EasyGridCloseButtonCell myCell = cell as EasyGridCloseButtonCell; EasyGridCloseButtonColumn col = _view.ListView.Columns[colIndex] as EasyGridCloseButtonColumn; myCell.BaseText = (col.Text == null)? "X" : col.Text; myCell.Value = value; /* * myCell.BaseText = _titleInitData[colIndex] as String; * myCell.Value = value; */ } #endregion #region Image else if (itemType == ItemTypes.Image) { cell = new EasyGridImageCell(_view.ListView); EasyGridImageColumn col = _view.ListView.Columns[colIndex] as EasyGridImageColumn; EasyGridImageCell myCell = cell as EasyGridImageCell; if (myCell.Images == null || myCell.Images.Count == 0) { if (col.Images != null && col.Images.Count > 0) { myCell.Images = col.Images; } } //if (_titleInitData[colIndex] != null && _titleInitData[colIndex] is ICollection<Image>) myCell.Images = (_titleInitData as ICollection<Image>); if (value == null) { if (myCell.Images != null && myCell.Images.Count > 0) { myCell.Value = 0; } //myCell.Value = ""; } else if (value is string) { int intval; if (int.TryParse(value as String, out intval)) { myCell.Value = intval; } else { if (myCell.Images != null && myCell.Images.Count > 0) { myCell.Value = 0; } } } else { myCell.Value = value; } } #endregion #region ImageButton else if (itemType == ItemTypes.ImageButton) { cell = new EasyGridImageButtonCell(_view.ListView); EasyGridImageButtonColumn col = _view.ListView.Columns[colIndex] as EasyGridImageButtonColumn; EasyGridImageButtonCell myCell = cell as EasyGridImageButtonCell; if (myCell.Images == null || myCell.Images.Count == 0) { if (col.Images != null && col.Images.Count > 0) { myCell.Images = col.Images; } } //if (_titleInitData[colIndex] != null && _titleInitData[colIndex] is ICollection<Image>) myCell.Images = (_titleInitData as ICollection<Image>); if (value == null) { //myCell.Value = ""; if (myCell.Images != null && myCell.Images.Count > 0) { myCell.Value = 0; } } else if (value is string) { int intval; if (int.TryParse(value as String, out intval)) { myCell.Value = intval; } else { myCell.Value = value; } } else { myCell.Value = value; } } #endregion else //Variables { /* * if (value is EasyGridVariousTypeCellInfo) * { * cell = getVariousCell(value as EasyGridVariousTypeCellInfo, tooltip); * } */ if (value is EasyGridCellInfo) { cell = SetVariousCell(value as EasyGridCellInfo, tooltip); } else { EasyGridCellInfo info = new EasyGridCellInfo(); info.ItemType = ItemTypes.TextBox; info.Text = (value != null)? value.ToString() : ""; info.IsEditable = true; cell = SetVariousCell(info, tooltip); //throw new Exception("테이블 [" + _view.Name + "]의 입력 멤버타입이 틀립니다. row:" + row.Index + ", cell:" + colIndex + ", trying value:" + (value as String) + "/ 원래 타입:EasyGridVariousTypeCellInfo"); } } if (tooltip != null && tooltip.Length > 0) { (cell as DataGridViewCell).ToolTipText = tooltip; } row.Cells.Add(cell as DataGridViewCell); }