示例#1
0
        /// <summary>
        /// Raises the <see cref="E:MouseDown" /> event.
        /// </summary>
        /// <param name="e">The <see cref="DataGridViewCellMouseEventArgs"/> instance containing the event data.</param>
        protected override void OnMouseDown(DataGridViewCellMouseEventArgs e)
        {
            Rectangle dis       = DataGridView.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false);
            Rectangle glyphRect = new Rectangle(dis.X + GlyphMargin, dis.Y, INDENT_WIDTH, dis.Height - 1);

            //if (e.X > this.InheritedStyle.Padding.Left)
            if ((e.X + dis.X <= glyphRect.X + 11) &&
                (e.X + dis.X >= glyphRect.X))
            {
                // Expand the node
                //TODO: Calculate more precise location
                OutlookGridRow node = OwningNode;
                if (node != null)
                {
                    ((KryptonOutlookGrid)node.DataGridView)._inExpandCollapseMouseCapture = true;

                    if (node.Collapsed)
                    {
                        node.Expand();
                    }
                    else
                    {
                        node.Collapse();
                    }
                }
            }
            else
            {
                base.OnMouseDown(e);
            }
        }