public void SetValue(EasyGridCellInfo info)
        {
            this.IsEditable    = info.IsEditable;
            this.TextAlignMode = info.TextAlignMode;
            switch (this.TextAlignMode)
            {
            case TextAlignModes.Left:
            case TextAlignModes.None:
                base.Style.Alignment = DataGridViewContentAlignment.MiddleLeft;
                break;

            case TextAlignModes.Center:
                base.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
                break;

            case TextAlignModes.NumberRightTextCenter:
                double num;
                if (double.TryParse(info.Text, out num))
                {
                    base.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
                }
                else
                {
                    base.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
                }
                break;

            case TextAlignModes.Right:
                base.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
                break;
            }

            SetValue(info.Text);
        }
Пример #2
0
 public void SetValue(EasyGridCellInfo info)
 {
     if (info.Items != null)
     {
         this.Items = info.Items;
     }
     this.Value = info.SelectedText;
 }
        public void SetValue(EasyGridCellInfo info)
        {
            if (info.Images != null)
            {
                this.Images = info.Images;
            }

            this.Value = info.CheckInt;
        }
Пример #4
0
 public void SetValue(EasyGridCellInfo info)
 {
     if (info.Items != null)
     {
         this.Items.Clear();
         this.Items.Add(info.Items);
         SetValue(info.SelectedIndex);
     }
 }
Пример #5
0
 public void SetValue(EasyGridCellInfo info)
 {
     if (info.ItemType == ItemTypes.KeyValue)
     {
         this.Value = info.KeyValue;
         if (info.KeyColor != null)
         {
             foreach (String key in info.KeyColor.Keys)
             {
                 this.Items.SetFontColor(key, info.KeyColor[key]);
             }
         }
     }
 }
Пример #6
0
        public void SetValue(EasyGridCellInfo info)
        {
            if (info.Images != null)
            {
                this.Images = info.Images;
            }

            if (info.SelectedIndex >= 0)
            {
                _selectedIndex   = info.SelectedIndex;
                base.Value       = (Images.Count > 0)? Images.ElementAt(_selectedIndex) : null;
                this.ImageLayout = info.ImageLayout;
            }
        }
        public void SetValue(EasyGridCellInfo info)
        {
            if (info.Images != null)
            {
                this.Images = info.Images;
            }

            if (info.SelectedIndex >= 0)
            {
                _text = info.Text;
                if (Images != null && Images.Count > info.SelectedIndex)
                {
                    _selectedIndex = info.SelectedIndex;
                    _image         = Images.ElementAt(_selectedIndex);
                }

                this.ImageLayout = info.ImageLayout;
            }
        }
Пример #8
0
 public void SetValue(EasyGridCellInfo info)
 {
     base.Value = info.Text;
 }
Пример #9
0
 public virtual void SetValue(EasyGridCellInfo info)
 {
     SetValue(info.Text);
 }
 public void SetValue(EasyGridCellInfo info)
 {
     this.IsEditable    = info.IsEditable;
     this.TextAlignMode = info.TextAlignMode;
     SetValue(info.Text);
 }
Пример #11
0
 public void SetValue(EasyGridCellInfo info)
 {
     base.Value = info.Checked;
 }
Пример #12
0
 public void MakeCells(ICollection <object> values, ICollection <String> tooltips = null)
 {
     for (int grp = 0; grp < values.Count; grp++)
     {
         if (values.ElementAt(grp) is Array)
         {
             Array arr = values.ElementAt(grp) as Array;
             if (tooltips == null)
             {
                 AddItemInRow(this, values.ElementAt(grp));
             }
             else
             {
                 if (tooltips.Count > 0)
                 {
                     AddItemInRow(this, values.ElementAt(grp), tooltips.ElementAt(grp));
                 }
             }
         }
         else if (values.ElementAt(grp) is ICollection <object> )
         {
             ICollection <object> list = values.ElementAt(grp) as ICollection <object>;
             if (tooltips == null)
             {
                 AddItemInRow(this, values.ElementAt(grp));
             }
             else
             {
                 if (tooltips.Count > 0)
                 {
                     AddItemInRow(this, values.ElementAt(grp), tooltips.ElementAt(grp));
                 }
             }
         }
         else if (values.ElementAt(grp) is EasyGridCellInfo)
         {
             EasyGridCellInfo info = values.ElementAt(grp) as EasyGridCellInfo;
             if (tooltips == null)
             {
                 IEasyGridCell cell = SetVariousCell(info);
                 this.Cells.Add(cell as DataGridViewCell);
             }
             else
             {
                 IEasyGridCell cell = SetVariousCell(info, tooltips.ElementAt(grp));
                 this.Cells.Add(cell as DataGridViewCell);
                 //AddItemInRow(this, values.ElementAt(grp), tooltips.ElementAt(grp));
             }
         }
         else //obj
         {
             if (tooltips == null)
             {
                 AddItemInRow(this, values.ElementAt(grp));
             }
             else
             {
                 AddItemInRow(this, values.ElementAt(grp), tooltips.ElementAt(grp));
             }
         }
     }
 }
Пример #13
0
        //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);
        }
Пример #14
0
        /// <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);
        }