本文整理汇总了C++中CGridCtrl::RedrawCell方法的典型用法代码示例。如果您正苦于以下问题:C++ CGridCtrl::RedrawCell方法的具体用法?C++ CGridCtrl::RedrawCell怎么用?C++ CGridCtrl::RedrawCell使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGridCtrl
的用法示例。
在下文中一共展示了CGridCtrl::RedrawCell方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ClickedCellCtl
/*****************************************************************************
Called during all the mouse events associated with clicking a control
embedded within a cell. Override to have more elaborate handling like
implementing radio button logic.
*****************************************************************************/
BOOL CGridBtnCellBase::ClickedCellCtl( UINT uMsg, // Command that invoked. e.g. WM_LBUTTONDOWN
int aiWhich) // zero-based index of image to draw
// returns: T=redraw occurred / F=no redraw
{
if( aiWhich < 0
|| aiWhich >= GetDrawCtlNbrMax() )
{
ASSERT( FALSE);
return FALSE;
}
UINT uiState = GetDrawCtlState( aiWhich);
if( uiState & DFCS_INACTIVE)
return FALSE; // button is inactive -- don't do anything
m_sLastCtlClicked = (short)aiWhich;
UINT iType = GetDrawCtlType( aiWhich);
switch( uMsg)
{
case WM_LBUTTONDOWN:
// appears pushed in
uiState |= DFCS_PUSHED;
SetDrawCtlState( aiWhich, uiState);
break;
case WM_LBUTTONUP:
case WM_LBUTTONDBLCLK:
// appears pushed out
uiState &= (~DFCS_PUSHED);
// auto check / uncheck controls, too
if( iType == DFC_BUTTON )
{
BOOL bIsMbrRadioGrp = GetDrawCtlIsMbrRadioGrp( aiWhich);
if( uiState & DFCS_BUTTONRADIO
|| bIsMbrRadioGrp )
{
// radio buttons or any button flagged as being part
// of a radio group will be made to look pressed down
// while pushing-up / unchecking all other members
// of the radio group
const int iCtlNbr = GetDrawCtlNbr();
UINT uiStateRadio;
for( int i1=0; i1 < iCtlNbr; i1++)
{
if( i1 != aiWhich)
{
uiStateRadio = GetDrawCtlState( i1);
bIsMbrRadioGrp = GetDrawCtlIsMbrRadioGrp( i1);
if( uiStateRadio & DFCS_BUTTONRADIO
|| bIsMbrRadioGrp )
{
uiStateRadio &= (~( DFCS_PUSHED | DFCS_CHECKED) );
// push out and uncheck
SetDrawCtlState( i1, uiStateRadio);
}
}
}
uiState |= DFCS_CHECKED; // check
if( !(uiState & DFCS_BUTTONRADIO) )
uiState |= DFCS_PUSHED; // press in if not real radio button
}
else if( !( uiState & ALL_BUT_BTN_CHK) )
{
// not a pushbutton -- it's a check box
// (can't check for DFCS_BUTTONCHECK directly since it is bit 0)
if( uiState & DFCS_CHECKED)
uiState &= (~DFCS_CHECKED); // uncheck
else
uiState |= DFCS_CHECKED; // check
}
}
SetDrawCtlState( aiWhich, uiState);
break;
default:
ASSERT( FALSE); // gotta handle new message
return FALSE;
}
CGridCtrl* pGrid = GetGrid();
ASSERT( pGrid);
pGrid->RedrawCell( m_iRow, m_iCol);
return TRUE;
}