Ejemplo n.º 1
0
        private void ArgumentsList_MouseClick(object sender, MouseEventArgs e)
        {
            ListViewHitTestInfo Info = ArgumentsList.HitTest(e.Location);

            if (Info.Item.Index == ArgumentsList.Items.Count - 1)
            {
                ListViewItem NewItem = new ListViewItem();
                NewItem.Checked = true;
                NewItem         = ArgumentsList.Items.Insert(ArgumentsList.Items.Count - 1, NewItem);
                NewItem.BeginEdit();
            }
            else
            {
                using (Graphics Graphics = ArgumentsList.CreateGraphics())
                {
                    int LabelOffset = e.X - CheckBoxPadding - CheckBoxRenderer.GetGlyphSize(Graphics, CheckBoxState.CheckedNormal).Width - CheckBoxPadding;
                    if (LabelOffset >= 0 && LabelOffset < TextRenderer.MeasureText(Info.Item.Text, ArgumentsList.Font).Width)
                    {
                        Info.Item.BeginEdit();
                    }
                }
            }
        }