📄 rightimageview.cpp
字号:
// RightImageView.cpp : implementation file
//
#include "stdafx.h"
#include "GaMatch.h"
#include "RightImageView.h"
#include "windows.h"
#include "windowsx.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRightImageView
IMPLEMENT_DYNCREATE(CRightImageView, CScrollView)
CRightImageView::CRightImageView()
{
}
CRightImageView::~CRightImageView()
{
}
BEGIN_MESSAGE_MAP(CRightImageView, CScrollView)
//{{AFX_MSG_MAP(CRightImageView)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRightImageView drawing
void CRightImageView::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
ASSERT(GetDocument() != NULL);
CGaMatchDoc* pDoc =(CGaMatchDoc*) GetDocument();
SetScrollSizes(MM_TEXT, pDoc->GetRImgSize(pDoc->d_choice));
}
void CRightImageView::OnDraw(CDC* pDC)
{
pDoc =(CGaMatchDoc*) GetDocument();
LPRECT lpRect;
RECT rect;
POINT pt;
double x0,y0;
HDIB hDIB;
lpRect=▭
GetClientRect(lpRect);
pt=GetDeviceScrollPosition();
x0=pt.x/pDoc->ZoomFractor;
y0=pt.y/pDoc->ZoomFractor;
hDIB = pDoc->GetRImage(pDoc->d_choice);
if (hDIB != NULL)
{
LPSTR lpDIB = (LPSTR) ::GlobalLock((HGLOBAL) hDIB);
int cxDIB = (int) ::DIBWidth(lpDIB); // Size of DIB - x
int cyDIB = (int) ::DIBHeight(lpDIB); // Size of DIB - y
::GlobalUnlock((HGLOBAL) hDIB);
CRect rcDIB;
rcDIB.top = rcDIB.left = 0;
rcDIB.right = cxDIB;
rcDIB.bottom = cyDIB;
CRect rcDest;
if (pDC->IsPrinting()) // printer DC
{
// get size of printer page (in pixels)
int cxPage = pDC->GetDeviceCaps(HORZRES);
int cyPage = pDC->GetDeviceCaps(VERTRES);
// get printer pixels per inch
int cxInch = pDC->GetDeviceCaps(LOGPIXELSX);
int cyInch = pDC->GetDeviceCaps(LOGPIXELSY);
rcDest.top = rcDest.left = 0;
rcDest.bottom = (int)(((double)cyDIB * cxPage * cyInch)
/ ((double)cxDIB * cxInch));
rcDest.right = cxPage;
}
else // not printer DC
{
rcDest.top=rcDest.left=0;
rcDest.bottom=(long)(pDoc->ZoomFractor*rcDIB.bottom);
rcDest.right =(long)(pDoc->ZoomFractor*rcDIB.right);
}
::PaintDIB(pDC->m_hDC, &rcDest, pDoc->GetRImage(pDoc->d_choice),
&rcDIB, pDoc->GetRImgPalette(pDoc->d_choice));
pDC->SetROP2(R2_BLACK);
}
}
/////////////////////////////////////////////////////////////////////////////
// CRightImageView diagnostics
#ifdef _DEBUG
void CRightImageView::AssertValid() const
{
CScrollView::AssertValid();
}
void CRightImageView::Dump(CDumpContext& dc) const
{
CScrollView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CRightImageView message handlers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -