Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Missing pixel after the last column if you use __EGBS_BSE_EX_EAL_RIGHT_H Collapse All
Subject Author Date
Offer Har Dec 21, 2008 - 8:22 AM

Hi,


I set my grid like this:



    SiwModifyStyle(__EGBS_SFB_FULL_ROWS,__EGBS_SFB_MASK|__EGBS_GRIDLINES_V);
    BseModifyStyleEx(__EGBS_BSE_EX_EAL_RIGHT_H);

The problem is that after the last column, one pixel is not drawn:


Technical Support Dec 22, 2008 - 3:00 PM

Thank you for reporting this bug. It’s specific to grid windows based on full row selection model. To fix it, please update the source code for the following method:

void CExtGridBaseWnd::OnGbwPaintCell(
            CDC & dc,
            LONG nVisibleColNo,
            LONG nVisibleRowNo,
            LONG nColNo,
            LONG nRowNo,
            const RECT & rcCellExtra,
            const RECT & rcCell,
            const RECT & rcVisibleRange,
            DWORD dwAreaFlags,
            DWORD dwHelperPaintFlags
            ) const
{
            ASSERT_VALID( this );
            ASSERT( dc.GetSafeHdc() != NULL && nColNo >= 0 && nRowNo >= 0 );
            if( rcCell.right <= rcCell.left || rcCell.bottom <= rcCell.top )
                        return;
            ASSERT( rcCellExtra.right >= rcCellExtra.left );
            ASSERT( rcCellExtra.bottom >= rcCellExtra.top );
            ASSERT( rcCellExtra.left <= rcCell.left );
            ASSERT( rcCellExtra.top <= rcCell.top );
            ASSERT( rcCellExtra.right >= rcCell.right );
            ASSERT( rcCellExtra.bottom >= rcCell.bottom );
            nVisibleColNo; nVisibleRowNo; rcVisibleRange; rcCellExtra;

bool bHoverByColumn = ( (dwHelperPaintFlags&__EGCPF_HOVER_BY_COLUMN) != 0 ) ? true : false;
bool bHoverByRow = ( (dwHelperPaintFlags&__EGCPF_HOVER_BY_ROW) != 0 ) ? true : false;
bool bHighlightedBySelectedColumn = ( (dwHelperPaintFlags&__EGCPF_HIGHLIGHTED_BY_SELECTED_COLUMN) != 0 ) ? true : false;
bool bHighlightedBySelectedRow = ( (dwHelperPaintFlags&__EGCPF_HIGHLIGHTED_BY_SELECTED_ROW) != 0 ) ? true : false;
bool bHighlightedByFocusedColumn = ( (dwHelperPaintFlags&__EGCPF_HIGHLIGHTED_BY_FOCUSED_COLUMN) != 0 ) ? true : false;
bool bHighlightedByFocusedRow = ( (dwHelperPaintFlags&__EGCPF_HIGHLIGHTED_BY_FOCUSED_ROW) != 0 ) ? true : false;
bool bFocusedControl = ( (dwHelperPaintFlags&__EGCPF_FOCUSED_CONTROL) != 0 ) ? true : false;
bool bHighlightPressing = ( (dwHelperPaintFlags&(__EGCPF_HIGHLIGHTED_BY_PRESSED_COLUMN|__EGCPF_HIGHLIGHTED_BY_PRESSED_ROW)) != 0 ) ? true : false;

INT nColType = 0;
INT nRowType = 0;
            if( ( dwAreaFlags & __EGBWA_OUTER_LEFT ) != 0 )
                        nColType = -1;
            else 
                        if( ( dwAreaFlags & __EGBWA_OUTER_RIGHT ) != 0 )
                                    nColType = 1;
            if( ( dwAreaFlags & __EGBWA_OUTER_TOP ) != 0 )
                        nRowType = -1;
            else 
                        if( ( dwAreaFlags & __EGBWA_OUTER_BOTTOM ) != 0 )
                                    nRowType = 1;

COLORREF clrBack = OnGbwQueryBackColor( dc, nVisibleColNo, nVisibleRowNo, nColNo, nRowNo, nColType, nRowType, dwAreaFlags, dwHelperPaintFlags );
            if(                     clrBack != COLORREF( -1L ) 
                        &&        (! bHighlightPressing )
                        )
                        dc.FillSolidRect(
                                    &rcCell,
                                    clrBack
                                    );
            
            if( ( dwAreaFlags & __EGBWA_OUTER_CELLS ) != 0 )
            {
                        DWORD dwSiwStyleEx = SiwGetStyleEx();
                        if(                     (dwSiwStyleEx&__EGWS_EX_PM_COLORS) != 0
                                    &&        (dwHelperPaintFlags&__EGCPF_SIMPLIFIED_RENDERING_TARGET) == 0
                                    )
                        {
                                    if( PmBridge_GetPM()->Grid_PaintHeaderBackground( dc, rcCell, nColNo, nRowNo, nColType, nRowType, dwAreaFlags, dwHelperPaintFlags, (CObject*)this ) )
                                                return;
                        }

                        bool bDefaultDrawing = true;
                        if( (dwSiwStyleEx&__EGWS_EX_USE_THEME_API) != 0 )
                        {
                                    if(                     g_PaintManager.m_UxTheme.IsControlsThemed()
                                                &&        g_PaintManager.m_UxTheme.OpenThemeData( GetSafeHwnd(), L"HEADER" ) != NULL )
                                    {
                                                INT nStateID = 0;

                                                if( bHighlightPressing )
                                                            nStateID = HIS_PRESSED;
                                                else if( bHoverByColumn && bHoverByRow )
                                                            nStateID = HIS_HOT;
                                                else
                                                            nStateID = HIS_NORMAL;
                                                ASSERT( nStateID != 0 );

                                                if( g_PaintManager.m_UxTheme.DrawThemeBackground( dc.GetSafeHdc(), HP_HEADERITEM, nStateID, &rcCell, &rcCell ) == S_OK
                                                            )
                                                            bDefaultDrawing = false;
                                                g_PaintManager.m_UxTheme.CloseThemeData( true );
                                    }
                        } // if( (dwSiwStyleEx&__EGWS_EX_USE_THEME_API) != 0 )

                        if( bDefaultDrawing )
                        {
                                    if( clrBack != COLORREF( -1L ) )
                                                dc.FillSolidRect( &rcCell, clrBack );
                                    else if( bHighlightPressing )
                                    {
                                                CRect rcHighlightPressing( rcCell );
                                                if( (dwHelperPaintFlags&__EGCPF_HIGHLIGHTED_BY_PRESSED_COLUMN) != 0 )
                                                            rcHighlightPressing.DeflateRect( 0, 0, 1, 0 );
                                                if( (dwHelperPaintFlags&__EGCPF_HIGHLIGHTED_BY_PRESSED_ROW) != 0 )
                                                            rcHighlightPressing.DeflateRect( 0, 0, 0, 1 );
                                                dc.FillSolidRect(
                                                            &rcHighlightPressing, // &rcCell
                                                            OnSiwGetSysColor( COLOR_3DDKSHADOW )
                                                            );
                                    }
                                    else if( bHighlightedByFocusedColumn || bHighlightedByFocusedRow )
                                                dc.FillRect( &rcCell, &( OnSiwGetLighterOrDarkerBrush( -3 ) ) );
                                    else if( bHighlightedBySelectedColumn || bHighlightedBySelectedRow )
                                                dc.FillRect( &rcCell, &( OnSiwGetLighterOrDarkerBrush( -2 ) ) );
                                    else if( bHoverByColumn || bHoverByRow )
                                    {
                                                if( nColType == 0 || nRowType == 0 )
                                                            dc.FillRect( &rcCell, &( OnSiwGetLighterOrDarkerBrush( -1 ) ) );
                                    }
                                    else
                                    {
                                                if(                     (dwSiwStyleEx&(__EGWS_EX_PM_COLORS|__EGWS_EX_USE_THEME_API|__EGBS_EX_CORNER_AREAS_3D|__EGBS_EX_CORNER_AREAS_CURVE))
                                                                                                == (__EGBS_EX_CORNER_AREAS_3D|__EGBS_EX_CORNER_AREAS_CURVE)
                                                            &&        (
                                                                                    dwAreaFlags == (__EGBWA_OUTER_CELLS|__EGBWA_OUTER_LEFT|__EGBWA_OUTER_TOP)
                                                                        ||           dwAreaFlags == (__EGBWA_OUTER_CELLS|__EGBWA_OUTER_LEFT|__EGBWA_OUTER_BOTTOM)
                                                                        ||           dwAreaFlags == (__EGBWA_OUTER_CELLS|__EGBWA_OUTER_RIGHT|__EGBWA_OUTER_TOP)
                                                                        ||           dwAreaFlags == (__EGBWA_OUTER_CELLS|__EGBWA_OUTER_RIGHT|__EGBWA_OUTER_BOTTOM)
                                                                        )
                                                            )
                                                {
                                                }
                                                else
                                                {
                                                            COLORREF clrLT = OnSiwGetSysColor( COLOR_3DHIGHLIGHT );
                                                            COLORREF clrRB = OnSiwGetSysColor( COLOR_3DSHADOW );
                                                            dc.Draw3dRect( &rcCell, clrLT, clrRB );
                                                }
                                    }

                        } // if( bDefaultDrawing )

            } // if( ( dwAreaFlags & __EGBWA_OUTER_CELLS ) != 0 )
            else
            {
                        ASSERT( nRowNo >= 0 && nColNo >= 0 );
                        if( clrBack != COLORREF( -1L ) )
                                    dc.FillSolidRect( &rcCell, clrBack );
                        else if( bHighlightPressing )
                        {
                                    CRect rcHighlightPressing( rcCell );
                                    if( (dwHelperPaintFlags&__EGCPF_HIGHLIGHTED_BY_PRESSED_COLUMN) != 0 )
                                                rcHighlightPressing.DeflateRect( 0, 0, 1, 0 );
                                    if( (dwHelperPaintFlags&__EGCPF_HIGHLIGHTED_BY_PRESSED_ROW) != 0 )
                                                rcHighlightPressing.DeflateRect( 0, 0, 0, 1 );
                                    dc.FillSolidRect(
                                                &rcHighlightPressing, // &rcCell
                                                OnSiwGetSysColor( COLOR_3DDKSHADOW )
                                                );
                        } // if( bHighlightPressing )
                        else if( bHighlightedByFocusedColumn || bHighlightedByFocusedRow )
                                    dc.FillRect( &rcCell, &( OnSiwGetLighterOrDarkerBrush( 3 ) ) );
                        else if( bHighlightedBySelectedColumn || bHighlightedBySelectedRow )
                                    dc.FillRect( &rcCell, &( OnSiwGetLighterOrDarkerBrush( 2 ) ) );
                        else if( bHoverByColumn || bHoverByRow )
                                    dc.FillRect( &rcCell, &( OnSiwGetLighterOrDarkerBrush( 1 ) ) );
                        
                        bool bGridLinesHorz = false, bGridLinesVert = false;
                        if( ! bHighlightPressing )
                        {
                                    bGridLinesHorz =
                                                OnGbwQueryCellGridLines(
                                                            true, dc,
                                                            nVisibleColNo, nVisibleRowNo, nColNo, nRowNo,
                                                            rcCellExtra, rcCell, rcVisibleRange, dwAreaFlags, dwHelperPaintFlags
                                                            );
                                    bGridLinesVert =
                                                OnGbwQueryCellGridLines(
                                                            false, dc,
                                                            nVisibleColNo, nVisibleRowNo, nColNo, nRowNo,
                                                            rcCellExtra, rcCell, rcVisibleRange, dwAreaFlags, dwHelperPaintFlags
                                                            );
                        } // if( ! bHighlightPressing )

                        if( bFocusedControl || NoHideSelectionGet() )
                        {
                                    if( (!bHighlightPressing) && SelectionGetForCellPainting( nColNo, nRowNo ) )
                                    {
                                                COLORREF clrHighLight = OnSiwGetSysColor( bFocusedControl ? COLOR_HIGHLIGHT : COLOR_3DFACE );
                                                dc.FillSolidRect( &rcCell, clrBack != COLORREF( -1L ) ? clrBack : clrHighLight );
                                    } // if( (!bHighlightPressing) && SelectionGetForCellPainting( nColNo, nRowNo ) )
                                    CPoint ptFocus = FocusGet();
                                    DWORD dwBasicSelectionType = SiwGetStyle() & __EGBS_SFB_MASK;
                                    if(                     dwBasicSelectionType != __EGBS_SFB_NONE
                                                &&        ( ptFocus.x == nColNo || ptFocus.y == nRowNo )
                                                )
                                    {
                                                ASSERT(
                                                                        dwBasicSelectionType == __EGBS_SFB_CELLS
                                                            ||           dwBasicSelectionType == __EGBS_SFB_FULL_COLUMNS
                                                            ||           dwBasicSelectionType == __EGBS_SFB_FULL_ROWS
                                                            );
                                                DWORD dwScrollTypeH = SiwScrollTypeHGet();
                                                DWORD dwScrollTypeV = SiwScrollTypeVGet();
                                                LONG nColumnCount = ColumnCountGet();
                                                LONG nRowCount = RowCountGet();
                                                if( bFocusedControl )
                                                {
                                                            if(                     (dwBasicSelectionType == __EGBS_SFB_CELLS
//                                                                                  ||           (           dwScrollTypeH == __ESIW_ST_VIRTUAL
//                                                                                              &&        dwScrollTypeV == __ESIW_ST_VIRTUAL
//                                                                                              )
                                                                                    )
                                                                        &&        ptFocus.x == nColNo
                                                                        &&        ptFocus.y == nRowNo
                                                                        )
                                                            {
                                                                        CRect rcCellFocus( rcCell );
                                                                        rcCellFocus.DeflateRect( 0, 0, bGridLinesVert ? 1 : 0, bGridLinesHorz ? 1 : 0 );
                                                                        OnSiwDrawFocusRect( dc, &rcCellFocus, (CObject*)this );
                                                            } // if( dwBasicSelectionType == __EGBS_SFB_CELLS ...
                                                            else if(
                                                                                    dwBasicSelectionType == __EGBS_SFB_FULL_COLUMNS
                                                                        //&&      dwScrollTypeH != __ESIW_ST_VIRTUAL
                                                                        &&        ptFocus.x == nColNo
                                                                        )
                                                            {
                                                                        LONG nRowFirst = 0, nRowLast = 0, nRowFirstOffset = 0;
                                                                        OnGbwQueryVisibleRowRange( nRowFirst, nRowLast, nRowFirstOffset );
                                                                        ASSERT( nRowFirst <= nRowLast );
                                                                        CRect rcCellFocus( rcCell );
                                                                        rcCellFocus.DeflateRect( 0, bGridLinesHorz ? -1 : 0, bGridLinesVert ? 1 : 0, 0 );
                                                                        CRect rc( &rcCellFocus );
                                                                        rc.right = rc.left;
                                                                        if( ! bGridLinesHorz )
                                                                        {
                                                                                    rc.bottom ++;
                                                                                    rc.top --;
                                                                        }
                                                                        OnSiwDrawFocusRect( dc, &rc, (CObject*)this );
                                                                        rc = rcCellFocus;
                                                                        rc.left = rc.right;
                                                                        if( ! bGridLinesHorz )
                                                                        {
                                                                                    rc.bottom ++;
                                                                                    rc.top --;
                                                                        }
                                                                        OnSiwDrawFocusRect( dc, &rc, (CObject*)this );
                                                                        if(                     ( dwScrollTypeV != __ESIW_ST_VIRTUAL && nRowNo == 0 )
                                                                                    ||           ( dwScrollTypeV == __ESIW_ST_VIRTUAL && nRowNo == nRowFirst )
                                                                                    )
                                                                        {
                                                                                    rc = rcCellFocus;
                                                                                    rc.top ++;
                                                                                    rc.bottom = rc.top;
                                                                                    OnSiwDrawFocusRect( dc, &rc, (CObject*)this );
                                                                        }
                                                                        if(                     ( dwScrollTypeV != __ESIW_ST_VIRTUAL && nRowNo == (nRowCount-1) )
                                                                                    ||           ( dwScrollTypeV == __ESIW_ST_VIRTUAL && nRowNo == nRowLast )
                                                                                    )
                                                                        {
                                                                                    rc = rcCell;
                                                                                    rc.bottom --;
                                                                                    rc.top = rc.bottom;
                                                                                    OnSiwDrawFocusRect( dc, &rc, (CObject*)this );
                                                                        }
                                                            } // else if( dwBasicSelectionType == __EGBS_SFB_FULL_COLUMNS ...
                                                            else if(
                                                                                    dwBasicSelectionType == __EGBS_SFB_FULL_ROWS
                                                                        //&&      dwScrollTypeV != __ESIW_ST_VIRTUAL
                                                                        &&        ptFocus.y == nRowNo
                                                                        )
                                                            {
                                                                        LONG nColFirst = 0, nColLast = 0, nColFirstOffset = 0;
                                                                        OnGbwQueryVisibleColumnRange( nColFirst, nColLast, nColFirstOffset );
                                                                        ASSERT( nColFirst <= nColLast );
                                                                        CRect rcCellFocus( rcCell );
                                                                        rcCellFocus.DeflateRect( bGridLinesVert ? -1 : 0, 0, 0, bGridLinesHorz ? 1 : 0 );
                                                                        CRect rc( &rcCellFocus );
                                                                        rc.bottom = rc.top;
                                                                        if( !bGridLinesVert )
                                                                        {
                                                                                    rc.right ++;
                                                                                    rc.left --;
                                                                        }
                                                                        OnSiwDrawFocusRect( dc, &rc, (CObject*)this );
                                                                        rc = rcCellFocus;
                                                                        rc.top = rc.bottom;
                                                                        if( !bGridLinesVert )
                                                                        {
                                                                                    rc.right ++;
                                                                                    rc.left --;
                                                                        }
                                                                        OnSiwDrawFocusRect( dc, &rc, (CObject*)this );
                                                                        if(                     ( dwScrollTypeH != __ESIW_ST_VIRTUAL && nColNo == 0 )
                                                                                    ||           ( dwScrollTypeH == __ESIW_ST_VIRTUAL && nColNo == nColFirst )
                                                                                    )
                                                                        {
                                                                                    rc = rcCellFocus;
                                                                                    rc.left ++;
                                                                                    rc.right = rc.left;
                                                                                    OnSiwDrawFocusRect( dc, &rc, (CObject*)this );
                                                                        }
                                                                        if(                     ( dwScrollTypeH != __ESIW_ST_VIRTUAL && nColNo == (nColumnCount-1) )
                                                                                    ||           ( dwScrollTypeH == __ESIW_ST_VIRTUAL && nColNo == nColLast )
                                                                                    )
                                                                        {
                                                                                    rc = rcCell;
                                                                                    rc.right --;
                                                                                    rc.left = rc.right;
                                                                                    OnSiwDrawFocusRect( dc, &rc, (CObject*)this );
                                                                        }
                                                            } // if( dwBasicSelectionType == __EGBS_SFB_FULL_ROWS ...
                                                } // if( bFocusedControl )
                                    } // if( dwBasicSelectionType != __EGBS_SFB_NONE ...
                        } // if( bFocusedControl || NoHideSelectionGet() )

                        if( bGridLinesHorz || bGridLinesVert )
                        {
                                    COLORREF clrFace = OnGbwQueryGridLinesColor();
                                    if( bGridLinesHorz )
                                    {
                                                dc.FillSolidRect( rcCell.left - 1, rcCell.top - 1, rcCell.right - rcCell.left + 1, 1, clrFace );
                                                dc.FillSolidRect( rcCell.left - 1, rcCell.bottom - 1, rcCell.right - rcCell.left + 1, 1, clrFace );
                                    } // if( bGridLinesHorz )
                                    if( bGridLinesVert )
                                    {
                                                dc.FillSolidRect( rcCell.left - 1, rcCell.top, 1, rcCell.bottom - rcCell.top, clrFace );
                                                dc.FillSolidRect( rcCell.right - 1, rcCell.top, 1, rcCell.bottom - rcCell.top, clrFace );
                                    } // if( bGridLinesVert )
                        } // if( bGridLinesHorz || bGridLinesVert )
            } // else from if( ( dwAreaFlags & __EGBWA_OUTER_CELLS ) != 0 )
}