Click here to Skip to main content
16,005,037 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: about new operator in Visual C++ Pin
Nemanja Trifunovic23-Apr-07 6:03
Nemanja Trifunovic23-Apr-07 6:03 
Questionvisual C++ currencies convertor Pin
cmvr23-Apr-07 0:47
cmvr23-Apr-07 0:47 
AnswerRe: visual C++ currencies convertor Pin
CPallini23-Apr-07 2:03
mveCPallini23-Apr-07 2:03 
QuestionCompiler Error C2628 Pin
Programm3r23-Apr-07 0:43
Programm3r23-Apr-07 0:43 
AnswerRe: Compiler Error C2628 Pin
prasad_som23-Apr-07 1:15
prasad_som23-Apr-07 1:15 
QuestionRe: Compiler Error C2628 Pin
Programm3r23-Apr-07 1:40
Programm3r23-Apr-07 1:40 
AnswerRe: Compiler Error C2628 Pin
prasad_som23-Apr-07 19:32
prasad_som23-Apr-07 19:32 
QuestionRepainting problem On Minimize and Close button Pin
ksrameshkanth23-Apr-07 0:23
ksrameshkanth23-Apr-07 0:23 
Hi,
I have property sheet wizard application and I am repaining its title bar and creating new minimize and close button on title bar. The following codes are doing things ok. but when i try to right click on task bar button( applications task bar button - close/minimize application from system menu) minimize and close button is not repinted as expected. The codes are

void CSamplePaintSheet::OnNcPaint()
{
CWindowDC dc( this );
ModifyStyle(NULL,WS_SYSMENU|WS_MINIMIZEBOX);
Default();
ReDrawCaptionBar( &dc );
ReleaseDC( &dc );
}

BOOL CSamplePaintSheet::OnNcActivate( BOOL bActivate )
{
OnNcPaint();
return TRUE;
}

void CSamplePaintSheet::ReDrawCaptionBar(CDC *pDC )
{
CRect rc;
this->GetWindowRect( rc );
ScreenToClient( rc );

rcCap = rc;
rcCap.bottom = ::GetSystemMetrics( SM_CYCAPTION ) +
::GetSystemMetrics( SM_CYFIXEDFRAME );

rcCap.right += ::GetSystemMetrics( SM_CXFIXEDFRAME );

CString szTitle(_T("Sample Paint Application"));
SetWindowTextW( szTitle );
CBrush brSolid( CLR_GRAY );
pDC->FillRect( &rcCap, &brSolid );

CRect rcLeft( rc );
rcLeft.top = rcCap.bottom;
rcLeft.right = ::GetSystemMetrics( SM_CXFIXEDFRAME );
rcLeft.bottom = rc.Height();
pDC->FillRect( &rcLeft, &brSolid );

CRect rcRight( rc );
rcRight.left = rcCap.right - ::GetSystemMetrics( SM_CXFIXEDFRAME );
rcRight.top = rcLeft.top;
rcRight.right = rcCap.right;
rcRight.bottom = rcLeft.bottom;
pDC->FillRect( &rcRight, &brSolid );

CRect rcBottom( rc );
rcBottom.left = rcLeft.left;
rcBottom.top = rcRight.bottom - ::GetSystemMetrics(SM_CYFIXEDFRAME) -
nBottomBorderHeight;
rcBottom.right = rc.Width();
rcBottom.bottom = rcRight.bottom;
pDC->FillRect( &rcBottom, &brSolid );

CSize sizeText = pDC->GetTextExtent( szTitle );
int nCy = HIWORD( ::GetDialogBaseUnits() );
rcText = rcCap;

rcText.left = ::GetSystemMetrics( SM_CYFIXEDFRAME );
rcText.right = rcText.left + ( sizeText.cx );
rcText.top = (rcCap.bottom - (nCy + 1))/2;
rcText.bottom = rcText.top + nCy + 1;
pDC->SetBkMode( TRANSPARENT );
pDC->DrawText( szTitle, rcText, DT_LEFT | DT_SINGLELINE );

rcBtClose = rc;
rcBtClose.top = ::GetSystemMetrics( SM_CYFIXEDFRAME )+ 3;
rcBtClose.right = rcBottom.right - ::GetSystemMetrics( SM_CXFIXEDFRAME );
rcBtClose.left = rcBtClose.right - ::GetSystemMetrics( SM_CXSIZE ) + 8;
rcBtClose.bottom = ::GetSystemMetrics( SM_CYSIZE )- 3;
if( bBtClose )
{
pDC->DrawFrameControl
(rcBtClose,DFC_CAPTION,DFCS_CAPTIONCLOSE|DFCS_HOT );
}
else
{
pDC->DrawFrameControl
(rcBtClose,DFC_CAPTION,DFCS_CAPTIONCLOSE|DFCS_INACTIVE );
}

rcBtMin = rcBtClose;
rcBtMin.left = rcBtClose.left - rcBtClose.Width() -
::GetSystemMetrics( SM_CXFIXEDFRAME );
rcBtMin.right = rcBtMin.left + rcBtClose.Width();
pDC->DrawFrameControl(rcBtMin,DFC_CAPTION,DFCS_CAPTIONMIN|DFCS_HOT );
}

void CSamplePaintSheet::OnSysCommand( UINT nID, LPARAM lParam )
{
CDC *pDC = GetWindowDC();
ReDrawCaptionBar( pDC );
ReleaseDC( pDC );
CDialog::OnSysCommand( nID, lParam );
}
AnswerRe: Repainting problem On Minimize and Close button Pin
kcynic13-Jul-07 13:00
kcynic13-Jul-07 13:00 
Questionhow to compare two images/pixels? Pin
bigphish23-Apr-07 0:11
bigphish23-Apr-07 0:11 
AnswerRe: how to compare two images/pixels? Pin
prasad_som23-Apr-07 0:16
prasad_som23-Apr-07 0:16 
AnswerRe: how to compare two images/pixels? Pin
Hamid_RT25-Apr-07 7:39
Hamid_RT25-Apr-07 7:39 
QuestionC++ time (VS 6) Pin
Stevo Z22-Apr-07 23:48
Stevo Z22-Apr-07 23:48 
QuestionA need codes for DFP and Newton optimizations methods Pin
nico11dec22-Apr-07 22:35
nico11dec22-Apr-07 22:35 
QuestionMenu Font problem [modified] Pin
Neeraj Sinha22-Apr-07 22:10
Neeraj Sinha22-Apr-07 22:10 
AnswerRe: Menu Font problem Pin
Sarath C23-Apr-07 0:21
Sarath C23-Apr-07 0:21 
GeneralRe: Menu Font problem Pin
Neeraj Sinha23-Apr-07 0:38
Neeraj Sinha23-Apr-07 0:38 
QuestionMFC prog in Vista Pin
mahe_uma22-Apr-07 21:39
mahe_uma22-Apr-07 21:39 
AnswerRe: MFC prog in Vista Pin
Paresh Chitte22-Apr-07 23:03
Paresh Chitte22-Apr-07 23:03 
GeneralRe: MFC prog in Vista Pin
mahe_uma23-Apr-07 2:11
mahe_uma23-Apr-07 2:11 
GeneralRe: MFC prog in Vista Pin
Wes Aday23-Apr-07 4:53
professionalWes Aday23-Apr-07 4:53 
GeneralRe: MFC prog in Vista Pin
mahe_uma23-Apr-07 20:26
mahe_uma23-Apr-07 20:26 
Questionsystem date and time Pin
mkmut22-Apr-07 21:04
mkmut22-Apr-07 21:04 
AnswerRe: system date and time Pin
Arman S.22-Apr-07 21:12
Arman S.22-Apr-07 21:12 
AnswerRe: system date and time Pin
sthotakura22-Apr-07 21:16
sthotakura22-Apr-07 21:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.