1,建好对话框类CmyDialog
2,在菜单栏里添加新菜单假设ID为:ID_MENUITEM_MyDialog
3,打开classwizard,在CView类下给ID_MENUITEM_MyDialog添加消息COMMAND生成相应的函数,在函数内添加如下代码:
CMyDialog dlg;
dlg.DoModal();
4,在CMyView.cpp开始添加:#include "MyDialog.h"
生活充满阳光,快乐无处不在
virtual CSize ScaleViewportExt(
int xNum,
int xDenom,
int yNum,
int yDenom
);
CDC*pDC=GetDC();
pDC->Rectangle(CRect(0,0,200,200));
CDC::ScaleViewportExt (//这里如何定义呢);
Return Value
The previous viewport extents (in device units) as a CSize object.
Parameters
xNum
Specifies the amount by which to multiply the current x-extent.
xDenom
Specifies the amount by which to divide the result of multiplying the current x-extent by the value of the xNum parameter.
yNum
Specifies the amount by which to multiply the current y-extent.
yDenom
Specifies the amount by which to divide the result of multiplying the current y-extent by the value of the yNum parameter.
Remarks
Modifies the viewport extents relative to the current values. The formulas are written as follows:
xNewVE = ( xOldVE * xNum ) / xDenom
yNewVE = ( yOldVE * yNum ) / yDenom
The new viewport extents are calculated by multiplying the current extents by the given numerator and then dividing by the given denominator.