怎么改变VC下的坐标系

hrlhrl0 2010-06-15 10:07:45
把 __x
|
y
换成 y
|___x

...全文
180 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
na2650945 2010-06-16
  • 打赏
  • 举报
回复

pDC->SetMapMode(MM_ANISOTROPIC);
pDC->SetViewportOrg(rect.left,rect.bottom);
pDC->SetViewportExt(rect.right,-rect.bottom);
pDC->SetWindowExt(1000,1000);

8错。
先设置映射方式。
让后设置视口原点。
设置逻辑坐标如何转换到设备坐标。
设置窗口原点。
liudafei1 2010-06-16
  • 打赏
  • 举报
回复
用setWorldTransform吧,想怎么变就怎么变
scream7 2010-06-15
  • 打赏
  • 举报
回复
SetMapMode 函数状态: 正式函数
  函数功能描述:该函数设置指定设备环境的映射方式,映射方式定义了将逻辑单位转换为设备单位的度量单位,并定义了设备的X、Y轴的方向。
  函数原型:int SetMapMode(HDC hdc, int fnMapMode);
hdc:指向设备环境的句柄。
  fnMapMode:指定新的映射方式,此参数可以是下面列出的任何一个值。
  MM_ANISOTROPIC:逻辑单位转换成具有任意比例轴的任意单位,用SetWindowExtEx和SetViewportExtEx函数可指定单位、方向和比例。
  MM_HIENGLISH:每个逻辑单位转换为0.001英寸,X的正方面向右,Y的正方向向上。
  MM_HIMETRIC:每个逻辑单位转换为0.01毫米,X正方向向右,Y的正方向向上。
  MM_ISOTROPIC:逻辑单位转换成具有均等比例轴的任意单位,即沿X轴的一个单位等于沿Y轴的一个单位,用和函数可以指定该轴的单位和方向。图形设备界面(GDI)需要进行调整,以保证X和Y的单位保持相同大小(当设置窗口范围时,视口将被调整以达到单位大小相同)。
  MM_LOENGLISH:每个逻辑单位转换为0.1英寸,X正方向向右,Y正方向向上。
  MM_LOMETRIC:每个逻辑单位转换为0.1毫米,X正方向向右,Y正方向向上。
  MM_TEXT:每个逻辑单位转换为一个图素,X正方向向右,Y正方向向下。
  MM_TWIPS;每个逻辑单位转换为打印点的1/20(即1/1400英寸),X正方向向右,Y方向向上。
  返回值:如果函数调用成功,返回值指定先前的映射方式,否则,返回值为零,若想获得更多错误信息,请调用GetLastError函数。
Eleven 2010-06-15
  • 打赏
  • 举报
回复
改变映射模式就可以了SetMapMode
MM_ANISOTROPIC Logical units are converted to arbitrary units with arbitrarily scaled axes. Setting the mapping mode to MM_ANISOTROPIC does not change the current window or viewport settings. To change the units, orientation, and scaling, call the SetWindowExt and SetViewportExt member functions.

MM_HIENGLISH Each logical unit is converted to 0.001 inch. Positive x is to the right; positive y is up.

MM_HIMETRIC Each logical unit is converted to 0.01 millimeter. Positive x is to the right; positive y is up.

MM_ISOTROPIC Logical units are converted to arbitrary units with equally scaled axes; that is, 1 unit along the x-axis is equal to 1 unit along the y-axis. Use the SetWindowExt and SetViewportExt member functions to specify the desired units and the orientation of the axes. GDI makes adjustments as necessary to ensure that the x and y units remain the same size.

MM_LOENGLISH Each logical unit is converted to 0.01 inch. Positive x is to the right; positive y is up.

MM_LOMETRIC Each logical unit is converted to 0.1 millimeter. Positive x is to the right; positive y is up.

MM_TEXT Each logical unit is converted to 1 device pixel. Positive x is to the right; positive y is down.

MM_TWIPS Each logical unit is converted to 1/20 of a point. (Because a point is 1/72 inch, a twip is 1/1440 inch.) Positive x is to the right; positive y is up.
向立天 2010-06-15
  • 打赏
  • 举报
回复
就是一个数据映射的问题么
wltg2001 2010-06-15
  • 打赏
  • 举报
回复
用下面的代码就行了:
void CMy34View::OnDraw(CDC* pDC)
{
CMy34Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
CRect rect;
GetClientRect(&rect);

pDC->SetMapMode(MM_ANISOTROPIC);
pDC->SetViewportOrg(rect.left,rect.bottom);
pDC->SetViewportExt(rect.right,-rect.bottom);
pDC->SetWindowExt(1000,1000);

pDC->MoveTo(10,10);
pDC->LineTo(250,10);
pDC->MoveTo(10,10);
pDC->LineTo(10,950);
}
红色部分是改坐标系的,下面的LineTo语句是画线语句。
const_zl 2010-06-15
  • 打赏
  • 举报
回复
是不是可以交换变量啊
hrlhrl0 2010-06-15
  • 打赏
  • 举报
回复
OOOO

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧