Example #1
0
 public ColumnSpanInfo(IEasyGridColumn targetColumn, IEasyGridCell baseCell, int spanSize)
 {
     _targetColumn = targetColumn;
     BaseCell      = baseCell;
     SpanStart     = baseCell.RowIndex;
     SpanSize      = spanSize;
 }
        public XmlNode GetXml(XmlDocument xDoc, XmlNode parent = null)
        {
            XmlNode xTableNode = XmlAdder.Element(xDoc, "Table", parent);

            XmlNode xTableInfo     = XmlAdder.Element(xDoc, "TableInfo", xTableNode);
            XmlNode xBaseRowHeight = XmlAdder.Element(xDoc, "BaseRowHeight", this.BaseRowHeight.ToString(), xTableInfo);

            XmlNode xColumns = XmlAdder.Element(xDoc, "Columns", xTableNode);

            for (int colIndex = 0; colIndex < this.ColumnCount; colIndex++)
            {
                XmlNode xColumn = XmlAdder.Element(xDoc, "Column", xColumns);

                IEasyGridColumn col      = Columns(colIndex);
                ItemTypes       itemType = col.ItemType;

                switch (itemType)
                {
                case ItemTypes.Button:
                {
                    EasyGridButtonColumn c = col as EasyGridButtonColumn;
                    XmlNode xProperties    = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    XmlAdder.Attribute(xDoc, "BaseText", c.Text, xProperties);
                }
                break;

                case ItemTypes.CheckBox:
                {
                    EasyGridCheckBoxColumn c = col as EasyGridCheckBoxColumn;
                    XmlNode xProperties      = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "TriState", c.ThreeState ? "true" : "false", xProperties);
                }
                break;

                case ItemTypes.CheckBoxGroup:
                {
                    EasyGridCheckBoxGroupColumn c = col as EasyGridCheckBoxGroupColumn;
                    XmlNode xProperties           = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    if (c.Items.Count > 0)
                    {
                        XmlNode multiSelItems = XmlAdder.Element(xDoc, "MultiSelItems", xProperties);
                        for (int i = 0; i < c.Items.Count; i++)
                        {
                            XmlNode multiSelItem = XmlAdder.Element(xDoc, "MultiSelItem", c.Items[i].Text, multiSelItems);
                            XmlAdder.Attribute(xDoc, "Checked", c.Items[i].Checked ? "true" : "false", multiSelItem);
                        }
                    }
                }
                break;

                case ItemTypes.CloseButton:
                {
                    EasyGridCloseButtonColumn c = col as EasyGridCloseButtonColumn;
                    XmlNode xProperties         = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    XmlAdder.Attribute(xDoc, "BaseText", c.Text, xProperties);
                }
                break;

                case ItemTypes.ComboBox:
                {
                    EasyGridComboBoxColumn c = col as EasyGridComboBoxColumn;
                    XmlNode xProperties      = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    if (c.Items.Count > 0)
                    {
                        XmlNode singleSelItems = XmlAdder.Element(xDoc, "SingleSelItems", xProperties);
                        for (int i = 0; i < c.Items.Count; i++)
                        {
                            XmlAdder.Element(xDoc, "SingleSelItem", c.Items.ElementAt(i), singleSelItems);
                        }
                    }
                }
                break;

                case ItemTypes.FileOpenBox:
                {
                    EasyGridFileOpenBoxColumn c = col as EasyGridFileOpenBoxColumn;

                    XmlNode xProperties = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    XmlAdder.Attribute(xDoc, "Editable", c.IsEditable?"true":"false", xProperties);
                    XmlAdder.Attribute(xDoc, "TextAlignMode", c.ColumnTextAlignMode.ToString(), xProperties);
                }
                break;

                case ItemTypes.Image:
                {
                    EasyGridImageColumn c           = col as EasyGridImageColumn;
                    XmlNode             xProperties = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    XmlAdder.Attribute(xDoc, "TitleShowImage", c.SelectedIndex.ToString(), xProperties);
                    XmlImageList imgs = c.Images as XmlImageList;
                    if (imgs != null && imgs.Count > 0)
                    {
                        imgs.GetXml(xDoc, xProperties);
                    }
                }
                break;

                case ItemTypes.ImageButton:
                {
                    EasyGridImageButtonColumn c = col as EasyGridImageButtonColumn;
                    XmlNode xProperties         = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    XmlAdder.Attribute(xDoc, "TitleShowImage", c.SelectedIndex.ToString(), xProperties);
                    XmlAdder.Attribute(xDoc, "ShowTitleText", c.HeaderText.Length > 0 ? "true" : "false", xProperties);
                    XmlAdder.Attribute(xDoc, "UseColumnTextForButtonValue", c.UseColumnTextForButtonValue.ToString(), xProperties);
                    XmlImageList imgs = c.Images as XmlImageList;
                    if (imgs != null && imgs.Count > 0)
                    {
                        imgs.GetXml(xDoc, xProperties);
                    }
                }
                break;

                case ItemTypes.ImageCheckBox:
                {
                    EasyGridImageCheckBoxColumn c = col as EasyGridImageCheckBoxColumn;
                    XmlNode xProperties           = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    XmlAdder.Attribute(xDoc, "InitValue", c.SelectedIndex.ToString(), xProperties);

                    XmlCheckImageList imgs = c.Images as XmlCheckImageList;
                    if (imgs != null && imgs.Count > 0)
                    {
                        imgs.GetXml(xDoc, xProperties);
                    }
                    else
                    {
                        if (c.Images.Count > 1)
                        {
                            if (c.Images.ElementAt(1).Equals(FormAdders.Properties.Resources.check_red))
                            {
                                XmlAdder.Attribute(xDoc, "CheckColor", CheckBoxColors.Red.ToString(), xProperties);
                            }
                            else
                            {
                                XmlAdder.Attribute(xDoc, "CheckColor", CheckBoxColors.Blue.ToString(), xProperties);
                            }
                        }
                        else
                        {
                            XmlAdder.Attribute(xDoc, "CheckColor", CheckBoxColors.Red.ToString(), xProperties);
                        }
                    }
                }
                break;

                case ItemTypes.KeyValue:
                {
                    EasyGridKeyValueColumn c = col as EasyGridKeyValueColumn;
                    XmlNode xProperties      = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    XmlAdder.Attribute(xDoc, "TextAlignMode", c.ColumnTextAlignMode.ToString(), xProperties);
                }
                break;

                case ItemTypes.RadioButton:
                {
                    EasyGridRadioButtonColumn c = col as EasyGridRadioButtonColumn;
                    XmlNode xProperties         = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    if (c.Items.Count > 0)
                    {
                        XmlNode singleSelItems = XmlAdder.Element(xDoc, "SingleSelItems", xProperties);
                        for (int i = 0; i < c.Items.Count; i++)
                        {
                            XmlAdder.Element(xDoc, "SingleSelItem", c.Items[i].Text, singleSelItems);
                        }
                    }
                }
                break;

                case ItemTypes.TextBox:
                {
                    EasyGridTextBoxColumn c = col as EasyGridTextBoxColumn;
                    XmlNode xProperties     = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    XmlAdder.Attribute(xDoc, "TextAlignMode", c.ColumnTextAlignMode.ToString(), xProperties);
                    XmlAdder.Attribute(xDoc, "Editable", c.IsEditable ? "true" : "false", xProperties);
                    XmlAdder.Attribute(xDoc, "IsAutoSort", c.SortMode == DataGridViewColumnSortMode.Automatic ? "true" : "false", xProperties);
                }
                break;

                case ItemTypes.Various:
                {
                    EasyGridVariousColumn c = col as EasyGridVariousColumn;
                    XmlNode xProperties     = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                }
                break;
                }
            }

            Rows.GetXml(xDoc, xTableNode);

            return(xTableNode);
        }
Example #3
0
 public ColumnSpan(IEasyGridColumn column)
 {
     _targetColumn = column;
 }
Example #4
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);
        }