// ----------------------------------------------------------------------------
/**
* @brief
*/
// ----------------------------------------------------------------------------
void CMuResizableDialog::OnSupportVista()
{
bool bDwmMode = g_PaintManager.m_DWM.IsCompositionEnabled() ? true : false;
if( ! bDwmMode ){
return ;
}
HWND hWnd = m_hWnd;
CExtDWM::__EXT_DWMNCRENDERINGPOLICY ncrp = CExtDWM::__EXT_DWMNCRP_ENABLED;
HRESULT hr =
g_PaintManager.m_DWM.DwmSetWindowAttribute(
hWnd,
CExtDWM::__EXT_DWMWA_NCRENDERING_POLICY,
&ncrp, sizeof(ncrp)
);
BOOL bAllow = TRUE;
hr = g_PaintManager.m_DWM.DwmSetWindowAttribute(
hWnd, CExtDWM::__EXT_DWMWA_ALLOW_NCPAINT,
&bAllow, sizeof(bAllow)
);
hr;
}
// ----------------------------------------------------------------------------
/**
* @brief
*/
// ----------------------------------------------------------------------------
BOOL CMuResizableDialog::OnInitDialog()
{
VERIFY( CExtResizableDialog ::OnInitDialog() );
OnSupportVista();
:
:
:
}
// ----------------------------------------------------------------------------
/**
* @brief
*/
// ----------------------------------------------------------------------------
void CMuResizableDialog::OnNcPaint()
{
CExtResizableDialog::OnNcPaint();
ERPaint ( TRUE );
}
// ----------------------------------------------------------------------------
/**
* @brief
* @param
*/
// ----------------------------------------------------------------------------
void CMuResizableDialog::ERPaint( BOOL blActive )
{
if ( m_blERBtnFlag == FALSE )
return;
ERSize();
CDC * pCDC;
pCDC = this->GetWindowDC();
CBrush brush;
if ( m_blERHover == TRUE || blActive == FALSE ){
brush.CreateSolidBrush( GetSysColor( COLOR_BTNFACE ) );
pCDC->FillRect( &m_ERBtnRect , &brush );
brush.DeleteObject();
}else{
brush.CreateSolidBrush( GetSysColor( COLOR_BTNFACE ) );
pCDC->FillRect( &m_ERBtnRect , &brush );
brush.DeleteObject();
}
CPen _pen;
_pen.CreatePen( PS_SOLID , 1 , GetSysColor(COLOR_BTNHILIGHT) );
CPen * pOldPen = pCDC->SelectObject( &_pen );
pCDC->MoveTo( m_ERBtnRect.left , m_ERBtnRect.top );
pCDC->LineTo( m_ERBtnRect.right, m_ERBtnRect.top );
pCDC->MoveTo( m_ERBtnRect.left , m_ERBtnRect.top );
pCDC->LineTo( m_ERBtnRect.left , m_ERBtnRect.bottom );
_pen.DeleteObject();
_pen.CreatePen( PS_SOLID , 1 , GetSysColor(COLOR_BTNSHADOW ) );
pCDC->SelectObject( &_pen );
pCDC->MoveTo( m_ERBtnRect.right , m_ERBtnRect.bottom );
pCDC->LineTo( m_ERBtnRect.right , m_ERBtnRect.top - 1 );
pCDC->MoveTo( m_ERBtnRect.right , m_ERBtnRect.bottom );
pCDC->LineTo( m_ERBtnRect.left - 1 , m_ERBtnRect.bottom );
pCDC->SelectObject( pOldPen );
//--------------------------------------
//
int ArrowCnt;
int iRec;
CRgn RgnArrow;
POINT ArrowPnt[100];
int iSpace = 2;
if ( m_blERBtnWayFlag == FALSE ){
//-------------------------------------------
// 縮小矢印
ArrowCnt = 3;
ArrowPnt[0].x = iSpace;
ArrowPnt[0].y = m_BtnSize - iSpace;
ArrowPnt[1].x = m_BtnSize - iSpace;
ArrowPnt[1].y = m_BtnSize - iSpace;
ArrowPnt[2].x = m_BtnSize / 2;
ArrowPnt[2].y = iSpace;
}else{
//-------------------------------------------
// 拡大矢印
ArrowCnt = 3;
ArrowPnt[0].x = iSpace;
ArrowPnt[0].y = iSpace;
ArrowPnt[1].x = m_BtnSize - iSpace ;
ArrowPnt[1].y = iSpace;
ArrowPnt[2].x = m_BtnSize / 2;
ArrowPnt[2].y = m_BtnSize - iSpace;
}
for ( iRec = 0 ; iRec < ArrowCnt ; iRec++){
ArrowPnt[iRec].x = ArrowPnt[iRec].x + m_ERBtnRect.left;
ArrowPnt[iRec].y = ArrowPnt[iRec].y + m_ERBtnRect.top;
}
if ( blActive == TRUE ){
if ( m_blERHover == TRUE ){
//brush.CreateSolidBrush( GetSysColor(COLOR_INACTIVECAPTION ) );
brush.CreateSolidBrush( GetSysColor(COLOR_ACTIVECAPTION ) );
}else{
brush.CreateSolidBrush( GetSysColor(COLOR_ACTIVECAPTION ) );
}
}else{
brush.CreateSolidBrush( GetSysColor(COLOR_BTNSHADOW ) );
}
VERIFY ( RgnArrow.CreatePolygonRgn( ArrowPnt , ArrowCnt , ALTERNATE ) );
pCDC->FillRgn( &RgnArrow , &brush );
brush.DeleteObject();
this->ReleaseDC( pCDC );
}