Пример #1
0
 /// <summary>Initializes a new instance of the <see cref="VisualListViewSubItem" /> class.</summary>
 /// <param name="owner">The <see cref="VisualListViewItem" /> that represents the item that owns the subitem.</param>
 /// <param name="text">The text to display for the subitem.</param>
 /// <param name="foreColor">A <see cref="Color" /> that represents the foreground color of the item.</param>
 /// <param name="backColor">A <see cref="Color" /> that represents the background color of the item.</param>
 /// <param name="font">A <see cref="Font" /> that represents the font to display the item's text in.</param>
 public VisualListViewSubItem(VisualListViewItem owner, string text, Color foreColor, Color backColor, Font font) : this()
 {
     _owner     = owner;
     _text      = text;
     _foreColor = foreColor;
     _backColor = backColor;
     _font      = font;
 }
Пример #2
0
 /// <summary>Initializes a new instance of the <see cref="VisualListViewSubItem" /> class.</summary>
 public VisualListViewSubItem()
 {
     _imageIndex                = -1;
     _imageAlignment            = HorizontalAlignment.Left;
     _backColor                 = Color.White;
     _selected                  = false;
     _tag                       = null;
     _forceText                 = false;
     embeddedControl            = null;
     _listView                  = null;
     _checked                   = false;
     _checkBox                  = false;
     _embeddedControlProperties = null;
     _lastCellRect              = new Rectangle(0, 0, 0, 0);
     _foreColor                 = Color.Black;
     _font                      = SystemFonts.DefaultFont;
     _owner                     = null;
     _text                      = string.Empty;
 }
Пример #3
0
        /// <summary>
        ///     Creates an identical copy of the current <see cref="VisualListViewItem" /> that is not attached to any list
        ///     view control.
        /// </summary>
        /// <returns>The <see cref="Object" />.</returns>
        public virtual object Clone()
        {
            VisualListViewSubItemCollection _clonedSubItemCollection = new VisualListViewSubItemCollection();

            for (var i = 0; i < _subItemCollection.Count; i++)
            {
                VisualListViewSubItem _subItem = _subItemCollection[i];

                _clonedSubItemCollection.Add(new VisualListViewSubItem(null, _subItem.Text, _subItem.ForeColor, _subItem.BackColor, _subItem.Font)
                {
                    Tag = _subItem.Tag
                });
            }

            Type _clonedType = GetType();
            VisualListViewItem _listViewItem;

            if (_clonedType == typeof(VisualListViewItem))
            {
                _listViewItem = new VisualListViewItem(_clonedSubItemCollection, _subItemCollection[0].ImageIndex);
            }
            else
            {
                _listViewItem = (VisualListViewItem)Activator.CreateInstance(_clonedType);
            }

            _listViewItem = new VisualListViewItem(_clonedSubItemCollection, -1)
            {
                ImageIndex = _subItemCollection[0].ImageIndex,
                Tag        = _tag,
                BackColor  = _backColor,
                ForeColor  = _foreColor,
                Font       = _font,
                Text       = Text
            };

            // if (!string.IsNullOrEmpty(_imageKey))
            // {
            // _listViewItem.ImageIndexer.Key = _imageKey;
            // }
            return(_listViewItem);
        }
        /// <summary>
        ///     Creates an identical copy of the current <see cref="VisualListViewItem" /> that is not attached to any list
        ///     view control.
        /// </summary>
        /// <returns>The <see cref="Object" />.</returns>
        public virtual object Clone()
        {
            VisualListViewSubItemCollection _clonedSubItemCollection = new VisualListViewSubItemCollection();

            for (var i = 0; i < _subItemCollection.Count; i++)
            {
                VisualListViewSubItem _subItem = _subItemCollection[i];

                _clonedSubItemCollection.Add(new VisualListViewSubItem(null, _subItem.Text, _subItem.ForeColor, _subItem.BackColor, _subItem.Font)
                {
                    Tag = _subItem.Tag
                });
            }

            Type _clonedType = GetType();
            VisualListViewItem _listViewItem;

            if (_clonedType == typeof(VisualListViewItem))
            {
                _listViewItem = new VisualListViewItem(_clonedSubItemCollection, _subItemCollection[0].ImageIndex);
            }
            else
            {
                _listViewItem = (VisualListViewItem)Activator.CreateInstance(_clonedType);
            }

            _listViewItem.SubItems.Clear();
            foreach (VisualListViewSubItem subItem in _clonedSubItemCollection)
            {
                _listViewItem.SubItems.Add(subItem);
            }

            _listViewItem.Checked    = _subItemCollection[0].Checked;
            _listViewItem.ImageIndex = _subItemCollection[0].ImageIndex;
            _listViewItem.Tag        = _tag;
            _listViewItem.BackColor  = _backColor;
            _listViewItem.ForeColor  = _foreColor;
            _listViewItem.Font       = _font;
            _listViewItem.Text       = Text;
            return(_listViewItem);
        }
Пример #5
0
 /// <summary>Initializes a new instance of the <see cref="VisualListViewSubItem" /> class.</summary>
 /// <param name="owner">The <see cref="VisualListViewItem" /> that represents the item that owns the subitem.</param>
 /// <param name="text">The text to display for the subitem.</param>
 public VisualListViewSubItem(VisualListViewItem owner, string text) : this()
 {
     _owner = owner;
     _text  = text;
 }