// LUserBitmap.cpp: implementation of the LUserBitmap class. // ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "clipf32.h" #include "MainFrm.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// LUserBitmap::LUserBitmap() { m_pKfmnDlg = NULL; } LUserBitmap::~LUserBitmap() { } L_INT LUserBitmap::StatusCallBack(L_INT nPercentComplete) { if(NULL != m_pKfmnDlg) { m_pKfmnDlg->m_progress.SetPos(nPercentComplete); if(nPercentComplete == 100) m_pKfmnDlg->m_progress.SetPos(0); if(m_pKfmnDlg->m_bKillProgress) return SUCCESS_ABORT; } else { MSG msg; CMainFrame* pFrame = (CMainFrame*)AfxGetApp()->GetMainWnd(); if (!pFrame) return 0; pFrame->m_bInProcess = TRUE; pFrame->m_wndStatusBar.SetPaneText( 1, _T("Press ESC to cancel"), TRUE); if (nPercentComplete == 100) { pFrame->m_Progress.SetPos( 0 ); pFrame->m_wndStatusBar.SetPaneText( 1, _T(""), TRUE); } else pFrame->m_Progress.SetPos( nPercentComplete ); if (pFrame->m_bAbortProcess) { pFrame->m_Progress.SetPos( 0 ); pFrame->m_wndStatusBar.SetPaneText( 1, _T(""), TRUE); pFrame->m_bInProcess = FALSE; pFrame->m_bAbortProcess = FALSE; return SUCCESS_ABORT; } if(PeekMessage (&msg, m_hview, 0, 0, PM_REMOVE)) { TranslateMessage (&msg); DispatchMessage (&msg); } } return SUCCESS; } void LUserBitmap::OnDraw(HDC hdc, RECT &Rect) { RECT rcDst; HBRUSH hBrush; HRGN hTmpRgn = NULL; RECT rcRect; GetRects(NULL, NULL, &rcDst, NULL); if(m_pKfmnDlg != NULL) { if(m_pKfmnDlg->m_bShowTrackFrame) { hTmpRgn = CreateRectRgn(0, 0, 1, 1); CombineRgn(hTmpRgn, m_pKfmnDlg->m_hRgn, 0, RGN_COPY); GetRgnBox(m_pKfmnDlg->m_hRgn, &rcRect); OffsetRgn(hTmpRgn, rcDst.left, rcDst.top); hBrush = CreateSolidBrush(m_pKfmnDlg->m_crFrame); FrameRgn(hdc, hTmpRgn, hBrush, 1, 1); DeleteObject(hBrush); DeleteObject(hTmpRgn); } if(m_pKfmnDlg) m_pKfmnDlg->Btmp_Timer(); return; } }