예제 #1
0
        /// <summary>
        /// this function checks if the user hit the expand (+) or collapse (-) icon.
        /// if it was hit it will return true
        /// </summary>
        /// <param name="e">mouse click event arguments</param>
        /// <returns>returns true if the icon was hit, false otherwise</returns>
        internal bool IsIconHit(DataGridViewCellMouseEventArgs e)
        {
            if (e.ColumnIndex < 0)
            {
                return(false);
            }
            if (!isGroupRow)
            {
                return(false);
            }

            KryptonOutlookGrid grid      = (KryptonOutlookGrid)DataGridView;
            Rectangle          rowBounds = grid.GetRowDisplayRectangle(Index, false);

            int rowHeadersWidth = grid.RowHeadersVisible ? grid.RowHeadersWidth : 0;
            int l = e.X + grid.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Left;

            if (isGroupRow &&
                (l >= rowBounds.Left + rowHeadersWidth - grid.HorizontalScrollingOffset + 4 + group.Level * StaticValues._groupLevelMultiplier) &&
                (l <= rowBounds.Left + rowHeadersWidth - grid.HorizontalScrollingOffset + 4 + group.Level * StaticValues._groupLevelMultiplier + 11) &&
                (e.Y >= rowBounds.Height - 18) &&
                (e.Y <= rowBounds.Height - 7))
            {
                return(true);
            }

            return(false);
        }
예제 #2
0
        //internal bool IsNodeIconHit(DataGridViewCellMouseEventArgs e)
        //{
        //    if (e.ColumnIndex < 0) return false;
        //    if (!this.HasChildren) return false;

        //    DataGridViewCell cell = this.Cells[e.ColumnIndex];
        //    if (cell.GetType() is KryptonDataGridViewTreeTextCell) {
        //    cell.
        //    }
        //    KryptonOutlookGrid grid = (KryptonOutlookGrid)this.DataGridView;


        //    Rectangle glyphRect = new Rectangle(rect.X + this.GlyphMargin, rect.ContentBounds.Y, INDENT_WIDTH, this.ContentBounds.Height - 1);

        //    if ((e.X <= glyphRect.X + 11) &&
        //        (e.X >= glyphRect.X) &&
        //       (e.Y >= glyphRect.Y + (glyphRect.Height / 2) - 4) &&
        //     (e.Y <= glyphRect.Y + (glyphRect.Height / 2) - 4 + 11))


        //    if (this.isGroupRow &&
        //        (l >= rowBounds.Left + rowHeadersWidth - grid.HorizontalScrollingOffset + 4 + group.Level * StaticValues._groupLevelMultiplier) &&
        //        (l <= rowBounds.Left + rowHeadersWidth - grid.HorizontalScrollingOffset + 4 + group.Level * StaticValues._groupLevelMultiplier + 11) &&
        //        (e.Y >= rowBounds.Height - 18) &&
        //        (e.Y <= rowBounds.Height - 7))
        //        return true;

        //    return false;
        //}

        internal bool IsGroupImageHit(DataGridViewCellMouseEventArgs e)
        {
            if (e.ColumnIndex < 0)
            {
                return(false);
            }
            if (!isGroupRow || group.GroupImage == null)
            {
                return(false);
            }


            KryptonOutlookGrid grid      = (KryptonOutlookGrid)DataGridView;
            Rectangle          rowBounds = grid.GetRowDisplayRectangle(Index, false);

            int rowHeadersWidth = grid.RowHeadersVisible ? grid.RowHeadersWidth : 0;
            int l = e.X + grid.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Left;
            int offsetHeight;

            if (KryptonManager.CurrentGlobalPalette.GetRenderer() == KryptonManager.RenderOffice2013)
            {
                offsetHeight = StaticValues._2013OffsetHeight;
            }
            else
            {
                offsetHeight = StaticValues._defaultOffsetHeight;
            }
            if (isGroupRow &&
                (l >= rowBounds.Left + rowHeadersWidth - grid.HorizontalScrollingOffset + 18 + group.Level * StaticValues._groupLevelMultiplier) &&
                (l <= rowBounds.Left + rowHeadersWidth - grid.HorizontalScrollingOffset + 18 + group.Level * StaticValues._groupLevelMultiplier + 16) &&
                (e.Y >= rowBounds.Height - offsetHeight) &&
                (e.Y <= rowBounds.Height - 6))
            {
                return(true);
            }

            return(false);
        }