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 » CExtGridCellButton question Collapse All
Subject Author Date
tera tera May 17, 2009 - 7:58 PM

 


Hello.


(1), Please teach a method to draw the frame line of the button.





(2), I want to change the background of the button.


Thanks,


 

Technical Support May 25, 2009 - 11:29 AM

We modified the following method for painting a custom border around button cells in the inner grid area only:

void CNxL_MlGrid::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
{
    //--note
    // ƒtƒH[ƒJƒX‚ª‚È‚¬‚Ä‚àŽ©g‚ªƒtƒH[ƒJƒX‚³‚ê‚Ä‚¢‚é‚Æ‚¢‚¤ƒtƒ‰ƒO‚𗧂Ăé
    dwHelperPaintFlags |= __EGCPF_FOCUSED_CONTROL;
    
    CExtGridWnd::OnGbwPaintCell( dc,
                                 nVisibleColNo,
                                 nVisibleRowNo,
                                 nColNo,
                                 nRowNo,
                                 rcCellExtra,
                                 rcCell,
                                 rcVisibleRange,
                                 dwAreaFlags,
                                 dwHelperPaintFlags
                               );

            if( ( dwAreaFlags & __EGBWA_INNER_CELLS ) != 0 )
            { // if inner data cell
                        const CExtGridCell * pCell = GridCellGet( nColNo, nRowNo );
                        if( pCell != NULL && pCell->IsKindOf( RUNTIME_CLASS(CExtGridCellButton) ) )
                        { // if button cell
                                    COLORREF clr1tl = RGB(192,0,0), clr1rb = RGB(128,0,0);
                                    CRect rc = rcCell;
                                    dc.Draw3dRect( &rc, clr1tl, clr1rb );
                                    rc.DeflateRect( 1, 1 );
                                    COLORREF clr2tl = RGB(255,0,0), clr2rb = RGB(144,0,0);
                                    dc.Draw3dRect( &rc, clr2tl, clr2rb );
                        } // if button cell
            } // if inner data cell

    
}
Is that what you need?

tera tera May 25, 2009 - 7:19 PM

Hello


First of all,

Because a line can draw, it is OK.

Why cannot a line actually draw with this sample?

I asked you a question.


Thanks,


 

Technical Support May 26, 2009 - 11:40 AM

Please let us know more details about your task. Which lines exactly do you need?

Your screen shots displaying default looking button cells. Do you need to customize the look of button?

Technical Support May 19, 2009 - 1:20 AM

The push button is painted in the CExtGridCell::OnPaintButton() virtual method. This method paints the button using the CExtPaintManger::Grid_PaintButton() method. The button’s look depend on which paint manager is used. But generally there are no fill color and button color based rules for button painting. The skin, native XP and Office 2007 paint manager are using bitmap based button shapes. So, you should implement the CExtGridCell::OnPaintButton() virtual method and completely repaint the button if you need some frame around it and some preferred button color.

tera tera May 25, 2009 - 3:25 AM

Hello.


The frame line of the button is not drawn.





I do not understand the cause that is not drawn.

Please teach it.

Give my best regards.


http://ifreeta.dee.cc/20090518/SampleMuGrid200904.lzh