Example #1
0
 /// <summary>
 /// Indicates if for the specified cell the sort is enabled.
 /// </summary>
 /// <param name="e"></param>
 /// <returns></returns>
 public bool IsSortEnable(PositionEventArgs e)
 {
     if (e.Cell is ICellSortableHeader && m_bEnableSort)
     {
         ICellSortableHeader l_tmp    = (ICellSortableHeader)e.Cell;
         SortStatus          l_Status = l_tmp.GetSortStatus(e.Position);
         return(l_Status.EnableSort);
     }
     else
     {
         return(false);
     }
 }
 /// <summary>
 /// Indicates whether sorting is enabled for the specified cell.
 /// </summary>
 /// <param name="e">The <see cref="Fr.Medit.MedDataGrid.PositionEventArgs"/> instance containing the event data.</param>
 /// <returns>
 ///   <c>true</c> if is sort enabled for the specified cell; otherwise, <c>false</c>.
 /// </returns>
 private bool IsSortEnable(PositionEventArgs e)
 {
     if (e.Cell is ICellSortableHeader && doEnableSort)
     {
         ICellSortableHeader sortableHeaderCell = (ICellSortableHeader)e.Cell;
         SortStatus          sortStatus         = sortableHeaderCell.GetSortStatus(e.Position);
         return(sortStatus.EnableSort);
     }
     else
     {
         return(false);
     }
 }
        /// <summary>
        /// Handles the click event on the current cell
        /// </summary>
        /// <param name="e">The <see cref="Fr.Medit.MedDataGrid.PositionEventArgs"/> instance containing the event data.</param>
        public override void OnClick(PositionEventArgs e)
        {
            base.OnClick(e);

            if (IsSortEnable(e) &&
                (resize == null || (resize.IsHeightResizing == false && resize.IsWidthResizing == false)))
            {
                ICellSortableHeader sortableHeaderCell = (ICellSortableHeader)e.Cell;
                SortStatus          sortStatus         = sortableHeaderCell.GetSortStatus(e.Position);
                if (sortStatus.EnableSort)
                {
                    SortColumn(e, sortStatus.Mode != GridSortMode.Ascending, sortStatus.Comparer);
                }
            }
        }
Example #4
0
        /// <summary>
        /// Draw the image and the displaystring of the specified cell.
        /// </summary>
        /// <param name="p_Cell"></param>
        /// <param name="p_CellPosition"></param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status"></param>
        protected override void DrawCell_ImageAndText(SourceGrid2.Cells.ICellVirtual p_Cell, Position p_CellPosition, PaintEventArgs e, Rectangle p_ClientRectangle, DrawCellStatus p_Status)
        {
            base.DrawCell_ImageAndText(p_Cell, p_CellPosition, e, p_ClientRectangle, p_Status);

            if (p_Cell is ICellSortableHeader)
            {
                ICellSortableHeader l_Header = (ICellSortableHeader)p_Cell;
                SortStatus          l_Status = l_Header.GetSortStatus(p_CellPosition);
                if (l_Status.Mode == GridSortMode.Ascending)
                {
                    Utility.PaintImageAndText(e.Graphics, p_ClientRectangle, CommonImages.SortUp, ContentAlignment.MiddleRight, false, null, null, false, Border, Color.Black, null);
                }
                else if (l_Status.Mode == GridSortMode.Descending)
                {
                    Utility.PaintImageAndText(e.Graphics, p_ClientRectangle, CommonImages.SortDown, ContentAlignment.MiddleRight, false, null, null, false, Border, Color.Black, null);
                }
            }
        }
Example #5
0
        public override void OnClick(PositionEventArgs e)
        {
            base.OnClick(e);

            //eseguo il sort solo se non sono attualmente in resize
            if (IsSortEnable(e) &&
                (m_Resize == null || (m_Resize.IsHeightResizing == false && m_Resize.IsWidthResizing == false)))
            {
                ICellSortableHeader l_tmp    = (ICellSortableHeader)e.Cell;
                SortStatus          l_Status = l_tmp.GetSortStatus(e.Position);
                if (l_Status.EnableSort)
                {
                    if (l_Status.Mode == GridSortMode.Ascending)
                    {
                        SortColumn(e, false, l_Status.Comparer);
                    }
                    else
                    {
                        SortColumn(e, true, l_Status.Comparer);
                    }
                }
            }
        }