public override int DoDraw(DrawListViewSubItemEventArgs e, int x, EXColumnHeader ch) { EXBoolColumnHeader boolcol = (EXBoolColumnHeader)ch; Image boolimg; if (this.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); }
private void this_MouseDoubleClick(object sender, MouseEventArgs e) { EXListViewItem lstvItem = this.GetItemAt(e.X, e.Y) as EXListViewItem; if (lstvItem == null) { return; } _ClickedItem = lstvItem; int x = lstvItem.Bounds.Left; int i; for (i = 0; i < this.Columns.Count; i++) { x = x + this.Columns[i].Width; if (x > e.X) { x = x - this.Columns[i].Width; _ClickedSubItem = lstvItem.SubItems[i]; _ColumnIndex = i; break; } } if (!(this.Columns[i] is EXColumnHeader)) { return; } EXColumnHeader col = (EXColumnHeader)this.Columns[i]; if (col.GetType() == typeof(EXEditableColumnHeader)) { EXEditableColumnHeader editcol = (EXEditableColumnHeader)col; if (editcol.Control != null) { Control c = editcol.Control; if (c.Tag != null) { this.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, this.GetItemRect(this.Items.IndexOf(lstvItem)).Y); c.Width = this.Columns[i].Width; if (c.Width > this.Width) { c.Width = this.ClientRectangle.Width; } c.Text = _ClickedSubItem.Text; c.Visible = true; c.BringToFront(); c.Focus(); } else { _EditTextBox.Location = new Point(x, this.GetItemRect(this.Items.IndexOf(lstvItem)).Y); _EditTextBox.Width = this.Columns[i].Width; if (_EditTextBox.Width > this.Width) { _EditTextBox.Width = this.ClientRectangle.Width; } _EditTextBox.Text = _ClickedSubItem.Text; _EditTextBox.Visible = true; _EditTextBox.BringToFront(); _EditTextBox.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; } this.Invalidate(boolsubitem.Bounds); } } }