顺时针与逆时针
2015-11-14 23:10
211 查看
顺时针与逆时针
代码部分
CRect rect;
GetClientRect(&rect);
pDC->SetMapMode(MM_ANISOTROPIC);
pDC->SetWindowExt(rect.Width(), rect.Height());
pDC->SetWindowExt(rect.Width(), -rect.Height());
pDC->SetViewportOrg(rect.Width()/2, rect.Height()/2);
rect.OffsetRect(-rect.Width()/2, -rect.Height()/2);
CPoint Twelve(0, rect.Width()/2), Three(rect.Height()/2, 0);
CPen penBlack, penBlue, *pOldPen;
penBlack.CreatePen(PS_DASHDOT, 1, RGB(255, 0, 0));
penBlue.CreatePen(PS_SOLID, 1, RGB(0, 0, 255));
pDC->SetArcDirection(AD_CLOCKWISE);
pOldPen = pDC->SelectObject(&penBlue);
pDC->Arc(rect, Twelve, Three);
pDC->SetArcDirection(AD_COUNTERCLOCKWISE);
pOldPen = pDC->SelectObject(&penBlack);
pDC->Arc(rect, Twelve, Three);
pDC->SelectObject(pOldPen);
编译后
--------------------Configuration: Method - Win32 Debug--------------------
Compiling...
Skipping... (no relevant changes detected)
MethodView.cpp
MethodView.obj - 0 error(s), 0 warning(s)
链接后
--------------------Configuration: Method - Win32 Debug--------------------
Linking...
Method.exe - 0 error(s), 0 warning(s)
运行后,没有得到想要的结果。
CRect rect;
GetClientRect(&rect);
pDC->SetMapMode(MM_ANISOTROPIC);
pDC->SetWindowExt(rect.Width(), rect.Height());
pDC->SetWindowExt(rect.Width(), -rect.Height());
pDC->SetViewportOrg(rect.Width()/2, rect.Height()/2);
rect.OffsetRect(-rect.Width()/2, -rect.Height()/2);
CPoint Twelve(0, rect.Height()/2), Three(rect.Width()/2, 0);
CPen penBlack, penBlue, * pOldPen;
penBlue.CreatePen(PS_SOLID, 1, RGB(0, 0, 255));
penBlack.CreatePen(PS_DASHDOT, 1, RGB(255, 0, 0));
pDC->SetArcDirection(AD_CLOCKWISE);
pOldPen = pDC->SelectObject(&penBlue);
pDC->Arc(rect, Twelve, Three);
pDC->SetArcDirection(AD_COUNTERCLOCKWISE);
pOldPen = pDC->SelectObject(&penBlack);
pDC->Arc(rect, Twelve, Three);
pDC->SelectObject(pOldPen);
=============================================================分割线================================================================
CRect rect;
GetClientRect(&rect);
pDC->SetMapMode(MM_ANISOTROPIC);
pDC->SetWindowExt(rect.Width(), rect.Height());
pDC->SetViewportExt(rect.Width(), -rect.Height());
pDC->SetViewportOrg(rect.Width()/2, rect.Height()/2);
rect.OffsetRect(-rect.Width()/2, -rect.Height()/2);
CPoint Twelve(0, rect.Height()/2), Three(rect.Width()/2, 0);
CPen penBlack, penBlue, * pOldPen;
penBlue.CreatePen(PS_SOLID, 1, RGB(0, 0, 255));
penBlack.CreatePen(PS_DASHDOT, 1, RGB(255, 0, 0));
pDC->SetArcDirection(AD_CLOCKWISE);
pOldPen = pDC->SelectObject(&penBlue);
pDC->Arc(rect, Twelve, Three);
pDC->SetArcDirection(AD_COUNTERCLOCKWISE);
pOldPen = pDC->SelectObject(&penBlack);
pDC->Arc(rect, Twelve, Three);
pDC->SelectObject(pOldPen);
现在可以得到正常结果,对比上下代码,可能无法找到区别
pDC->SetWindowExt(rect.Width(), rect.Height());
pDC->SetWindowExt(rect.Width(), -rect.Height());
pDC->SetViewportOrg(rect.Width()/2, rect.Height()/2);
和
pDC->SetWindowExt(rect.Width(), rect.Height());
pDC->SetViewportExt(rect.Width(), -rect.Height());
pDC->SetViewportOrg(rect.Width()/2, rect.Height()/2);
现在区别明显一些,在坐标系的设置上有着问题。编译,链接都无法找到错误的地方,仅仅是没有预期的结果。
代码部分
CRect rect;
GetClientRect(&rect);
pDC->SetMapMode(MM_ANISOTROPIC);
pDC->SetWindowExt(rect.Width(), rect.Height());
pDC->SetWindowExt(rect.Width(), -rect.Height());
pDC->SetViewportOrg(rect.Width()/2, rect.Height()/2);
rect.OffsetRect(-rect.Width()/2, -rect.Height()/2);
CPoint Twelve(0, rect.Width()/2), Three(rect.Height()/2, 0);
CPen penBlack, penBlue, *pOldPen;
penBlack.CreatePen(PS_DASHDOT, 1, RGB(255, 0, 0));
penBlue.CreatePen(PS_SOLID, 1, RGB(0, 0, 255));
pDC->SetArcDirection(AD_CLOCKWISE);
pOldPen = pDC->SelectObject(&penBlue);
pDC->Arc(rect, Twelve, Three);
pDC->SetArcDirection(AD_COUNTERCLOCKWISE);
pOldPen = pDC->SelectObject(&penBlack);
pDC->Arc(rect, Twelve, Three);
pDC->SelectObject(pOldPen);
编译后
--------------------Configuration: Method - Win32 Debug--------------------
Compiling...
Skipping... (no relevant changes detected)
MethodView.cpp
MethodView.obj - 0 error(s), 0 warning(s)
链接后
--------------------Configuration: Method - Win32 Debug--------------------
Linking...
Method.exe - 0 error(s), 0 warning(s)
运行后,没有得到想要的结果。
CRect rect;
GetClientRect(&rect);
pDC->SetMapMode(MM_ANISOTROPIC);
pDC->SetWindowExt(rect.Width(), rect.Height());
pDC->SetWindowExt(rect.Width(), -rect.Height());
pDC->SetViewportOrg(rect.Width()/2, rect.Height()/2);
rect.OffsetRect(-rect.Width()/2, -rect.Height()/2);
CPoint Twelve(0, rect.Height()/2), Three(rect.Width()/2, 0);
CPen penBlack, penBlue, * pOldPen;
penBlue.CreatePen(PS_SOLID, 1, RGB(0, 0, 255));
penBlack.CreatePen(PS_DASHDOT, 1, RGB(255, 0, 0));
pDC->SetArcDirection(AD_CLOCKWISE);
pOldPen = pDC->SelectObject(&penBlue);
pDC->Arc(rect, Twelve, Three);
pDC->SetArcDirection(AD_COUNTERCLOCKWISE);
pOldPen = pDC->SelectObject(&penBlack);
pDC->Arc(rect, Twelve, Three);
pDC->SelectObject(pOldPen);
=============================================================分割线================================================================
CRect rect;
GetClientRect(&rect);
pDC->SetMapMode(MM_ANISOTROPIC);
pDC->SetWindowExt(rect.Width(), rect.Height());
pDC->SetViewportExt(rect.Width(), -rect.Height());
pDC->SetViewportOrg(rect.Width()/2, rect.Height()/2);
rect.OffsetRect(-rect.Width()/2, -rect.Height()/2);
CPoint Twelve(0, rect.Height()/2), Three(rect.Width()/2, 0);
CPen penBlack, penBlue, * pOldPen;
penBlue.CreatePen(PS_SOLID, 1, RGB(0, 0, 255));
penBlack.CreatePen(PS_DASHDOT, 1, RGB(255, 0, 0));
pDC->SetArcDirection(AD_CLOCKWISE);
pOldPen = pDC->SelectObject(&penBlue);
pDC->Arc(rect, Twelve, Three);
pDC->SetArcDirection(AD_COUNTERCLOCKWISE);
pOldPen = pDC->SelectObject(&penBlack);
pDC->Arc(rect, Twelve, Three);
pDC->SelectObject(pOldPen);
现在可以得到正常结果,对比上下代码,可能无法找到区别
pDC->SetWindowExt(rect.Width(), rect.Height());
pDC->SetWindowExt(rect.Width(), -rect.Height());
pDC->SetViewportOrg(rect.Width()/2, rect.Height()/2);
和
pDC->SetWindowExt(rect.Width(), rect.Height());
pDC->SetViewportExt(rect.Width(), -rect.Height());
pDC->SetViewportOrg(rect.Width()/2, rect.Height()/2);
现在区别明显一些,在坐标系的设置上有着问题。编译,链接都无法找到错误的地方,仅仅是没有预期的结果。
相关文章推荐
- 设计一款给爸爸妈妈用的手机
- Unity3D播放视频
- hdu 5565 Clarke and baton 二分
- 个人博客作业Week7
- Swift语言里的泛型与异常处理
- 透明画刷的使用
- 【转】css布局居中和CSS内容居中区别和对应DIV CSS代码
- 如何给App快速搭建虚拟服务器
- LeetCode — (1)
- 投票在线监测系统开发笔记
- BC 62 (div.2) A
- 在xml中调用自己用java代码定义的View
- AJAX异步请求——练习
- 信息安全系统设计基础第十周学习总结
- LeetCode_Median of Two Sorted Arrays
- 正则表达式案例
- hdu 5563 Clarke and five-pointed star 水题
- 安装使用神器vim
- codeforces 262B Roma and Changing Signs
- html中ul元素水平排列问题