Example #1
0
        public override int DoDraw(DrawListViewSubItemEventArgs e, int x, EXColumnHeader ch)
        {
            EXBoolColumnHeader boolcol = (EXBoolColumnHeader)ch;
            Image boolimg;

            if (BoolValue == true)
            {
                boolimg = boolcol.TrueImage;
            }
            else
            {
                boolimg = boolcol.FalseImage;
            }
            int imgy = e.Bounds.Y + ((int)(e.Bounds.Height / 2)) - ((int)(boolimg.Height / 2));

            e.Graphics.DrawImage(boolimg, x, imgy, boolimg.Width, boolimg.Height);
            x += boolimg.Width + 2;
            return(x);
        }
Example #2
0
        private void This_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            EXListViewItem lstvItem = GetItemAt(e.X, e.Y) as EXListViewItem;

            if (lstvItem == null)
            {
                return;
            }
            _clickeditem = lstvItem;
            int x = lstvItem.Bounds.Left;
            int i;

            for (i = 0; i < Columns.Count; i++)
            {
                x = x + Columns[i].Width;
                if (x > e.X)
                {
                    x = x - Columns[i].Width;
                    _clickedsubitem = lstvItem.SubItems[i];
                    _col            = i;
                    break;
                }
            }
            if (!(Columns[i] is EXColumnHeader))
            {
                return;
            }
            EXColumnHeader col = (EXColumnHeader)Columns[i];

            if (col.GetType() == typeof(EXEditableColumnHeader))
            {
                EXEditableColumnHeader editcol = (EXEditableColumnHeader)col;
                if (editcol.MyControl != null)
                {
                    Control c = editcol.MyControl;
                    if (c.Tag != null)
                    {
                        Controls.Add(c);
                        c.Tag = null;
                        if (c is ComboBox)
                        {
                            ((ComboBox)c).SelectedValueChanged += new EventHandler(Cmbx_SelectedValueChanged);
                        }
                        c.Leave += new EventHandler(C_Leave);
                    }
                    c.Location = new Point(x, GetItemRect(Items.IndexOf(lstvItem)).Y);
                    c.Width    = Columns[i].Width;
                    if (c.Width > Width)
                    {
                        c.Width = ClientRectangle.Width;
                    }
                    c.Text    = _clickedsubitem.Text;
                    c.Visible = true;
                    c.BringToFront();
                    c.Focus();
                }
                else
                {
                    txtbx.Location = new Point(x, GetItemRect(Items.IndexOf(lstvItem)).Y);
                    txtbx.Width    = Columns[i].Width;
                    if (txtbx.Width > Width)
                    {
                        txtbx.Width = ClientRectangle.Width;
                    }
                    txtbx.Text    = _clickedsubitem.Text;
                    txtbx.Visible = true;
                    txtbx.BringToFront();
                    txtbx.Focus();
                }
            }
            else if (col.GetType() == typeof(EXBoolColumnHeader))
            {
                EXBoolColumnHeader boolcol = (EXBoolColumnHeader)col;
                if (boolcol.Editable)
                {
                    EXBoolListViewSubItem boolsubitem = (EXBoolListViewSubItem)_clickedsubitem;
                    if (boolsubitem.BoolValue == true)
                    {
                        boolsubitem.BoolValue = false;
                    }
                    else
                    {
                        boolsubitem.BoolValue = true;
                    }
                    Invalidate(boolsubitem.Bounds);
                }
            }
        }