当前位置: 首页>>代码示例>>C++>>正文


C++ CGridCtrl::GetCellRect方法代码示例

本文整理汇总了C++中CGridCtrl::GetCellRect方法的典型用法代码示例。如果您正苦于以下问题:C++ CGridCtrl::GetCellRect方法的具体用法?C++ CGridCtrl::GetCellRect怎么用?C++ CGridCtrl::GetCellRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CGridCtrl的用法示例。


在下文中一共展示了CGridCtrl::GetCellRect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: RelPointInCtl

int CGridBtnCellBase::RelPointInCtl(    const CPoint& arPoint)  // Relative point coords
// returns:  Index of control that this point is within bounds of or -1 if no control matches
{
    CGridCtrl* pGrid = GetGrid();
    ASSERT( pGrid);

    CRect RectCell;
    if( pGrid->GetCellRect( m_iRow,
                            m_iCol,
                            &RectCell) )
    {
        ASSERT( MAX_NBR_CTLS_INCELL > GetDrawCtlNbrMax() ); // whoa!
        CRect RectAry[ MAX_NBR_CTLS_INCELL];

        if( CalcDrawCtlRects(   RectAry,    // returns:  CRects with coordinates
                                            //  last entry has optional leftover rect
                                            //  available for text, etc.
                                MAX_NBR_CTLS_INCELL,// nbr of Rects in above array
                                RectCell) ) // cell rectangle to work with
        {
            const int iCtlNbr = GetDrawCtlNbr();

            // make point absolute coord
            CPoint pointAbs;
            pointAbs.x = arPoint.x + RectCell.left;
            pointAbs.y = arPoint.y + RectCell.top;

            for( int i1=0; i1 < iCtlNbr; i1++)
            {
                if( pointAbs.x >= RectAry[i1].left
                    && pointAbs.x <= RectAry[i1].right
                    && pointAbs.y >= RectAry[i1].top
                    && pointAbs.y <= RectAry[i1].bottom)
                {
                    return i1;  // found it
                }

            }
        }
    }
    return -1;
}
开发者ID:Andrew-Phillips,项目名称:HexEdit,代码行数:42,代码来源:GridBtnCellBase.cpp

示例2: HasCellText

BOOL CGridBtnCellBase::HasCellText()
// returns:  F=auto-size buttons, only
{
    CGridCtrl* pGrid = GetGrid();
    ASSERT( pGrid);

    CRect RectCell;
    if( !pGrid->GetCellRect(m_iRow,
                            m_iCol,
                            &RectCell) )
        return FALSE;

    // rather than see if there is text assigned, check if any
    //  space allocated for text
    CRect RectText( RectCell);
    if( !GetTextRect( &RectText) ) // i/o:  i=dims of cell rect; o=dims of text rect
        return FALSE;

    if( RectText.Width() > 0 )
        return TRUE;

    return FALSE;
}
开发者ID:Andrew-Phillips,项目名称:HexEdit,代码行数:23,代码来源:GridBtnCellBase.cpp

示例3: OnClick

void CGridBtnCellCombo::OnClick( CPoint PointCellRelative)
{
    // immediately edit if user clicked on scroll down button picture

    int iCtlHit = RelPointInCtl( PointCellRelative);  // Relative point coords
    // returns:  Index of control that this point is within bounds of or -1 if no control matches

    BOOL bHitScrollDown = FALSE;
    if( iCtlHit >= 0)
    {
        // if user clicked on scroll down button picture, then show
        //  the drop-down, too

        UINT uiType = GetDrawCtlType( iCtlHit);
        UINT uiState = GetDrawCtlState( iCtlHit);

        bHitScrollDown =    ( uiType == DFC_SCROLL)
                            && uiState & DFCS_SCROLLDOWN;
    }
    if( bHitScrollDown)
    {
        // invoke the edit, now -- similar to CGridCtl::OnEditCell() logic
        CGridCtrl* pGrid = GetGrid();
        ASSERT( pGrid != NULL);

        CRect rect;
        if (!pGrid->GetCellRect( m_iRow, m_iCol, rect))
            return;

        SendMessageToParent(m_iRow, m_iCol, GVN_BEGINLABELEDIT);

        Edit( m_iRow, m_iCol, rect, PointCellRelative, IDC_INPLACE_CONTROL, VK_LBUTTON);
        return;
    }

    CGridBtnCell::OnClick( PointCellRelative);
}
开发者ID:jsccl1988,项目名称:smartgis,代码行数:37,代码来源:GridBtnCellCombo.cpp


注:本文中的CGridCtrl::GetCellRect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。