Ejemplo n.º 1
0
        /// <summary>
        /// Creates the ClickedCellInfo from the data grid and the mouse coordinates of the click.
        /// </summary>
        /// <param name="dg">The data grid.</param>
        /// <param name="mouseCoord">The mouse coordinates of the click.</param>
        public void MouseClick(WorksheetController dg, Point mouseCoord)
        {
            bool bIsPropertyColumn = false;

            m_CellRectangle = new Rectangle(0, 0, 0, 0);
            m_Column        = GetColumnNumber(dg, mouseCoord, ref m_CellRectangle);
            m_Row           = GetRowNumber(dg, mouseCoord, ref m_CellRectangle, out bIsPropertyColumn);

            if (bIsPropertyColumn)
            {
                if (m_Column == -1)
                {
                    m_ClickedArea = ClickedAreaType.PropertyColumnHeader;
                }
                else if (m_Column >= 0)
                {
                    m_ClickedArea = ClickedAreaType.PropertyCell;
                }
                else
                {
                    m_ClickedArea = ClickedAreaType.OutsideAll;
                }

                int h = m_Column; m_Column = m_Row; m_Row = h; // Swap columns and rows since it is a property column
            }
            else // it is not a property related cell
            {
                if (m_Row == -1 && m_Column == -1)
                {
                    m_ClickedArea = ClickedAreaType.TableHeader;
                }
                else if (m_Row == -1 && m_Column >= 0)
                {
                    m_ClickedArea = ClickedAreaType.DataColumnHeader;
                }
                else if (m_Row >= 0 && m_Column == -1)
                {
                    m_ClickedArea = ClickedAreaType.DataRowHeader;
                }
                else if (m_Row >= 0 && m_Column >= 0)
                {
                    m_ClickedArea = ClickedAreaType.DataCell;
                }
                else
                {
                    m_ClickedArea = ClickedAreaType.OutsideAll;
                }
            }
        }
Ejemplo n.º 2
0
    /// <summary>
    /// Creates the ClickedCellInfo from the data grid and the mouse coordinates of the click.
    /// </summary>
    /// <param name="dg">The data grid.</param>
    /// <param name="mouseCoord">The mouse coordinates of the click.</param>
    public void MouseClick(WorksheetController dg, Point mouseCoord)
    {

      bool bIsPropertyColumn=false;
      m_CellRectangle = new Rectangle(0,0,0,0);
      m_Column = GetColumnNumber(dg,mouseCoord, ref m_CellRectangle);
      m_Row    = GetRowNumber(dg,mouseCoord,ref m_CellRectangle, out bIsPropertyColumn);

      if(bIsPropertyColumn)
      {
        if(m_Column==-1)
          m_ClickedArea = ClickedAreaType.PropertyColumnHeader;
        else if(m_Column>=0)
          m_ClickedArea = ClickedAreaType.PropertyCell;
        else
          m_ClickedArea = ClickedAreaType.OutsideAll;

        int h=m_Column; m_Column = m_Row; m_Row = h; // Swap columns and rows since it is a property column
      }
      else // it is not a property related cell
      {
        if(m_Row==-1 && m_Column==-1)
          m_ClickedArea = ClickedAreaType.TableHeader;
        else if(m_Row==-1 && m_Column>=0)
          m_ClickedArea = ClickedAreaType.DataColumnHeader;
        else if(m_Row>=0 && m_Column==-1)
          m_ClickedArea = ClickedAreaType.DataRowHeader;
        else if(m_Row>=0 && m_Column>=0)
          m_ClickedArea = ClickedAreaType.DataCell;
        else
          m_ClickedArea = ClickedAreaType.OutsideAll;
      }
    }