第五章 5-7 自定义的映射模式

来源:互联网 发布:java pdf生成 编辑:程序博客网 时间:2024/06/18 10:04

这里写图片描述

自定义的映射模式的坐标轴为x轴向右,y轴向上。
1,各向同性 MM_ISOTROPIC
保持视图坐标对应窗口坐标的物理比例相等,如:

SetMapMode(hdc, MM_ISOTROPIC);SetWindowExtEx(hdc, 100, 100, NULL);SetViewportExtEx(hdc, cxClient, cyClient,NULL);SetViewportOrgEx(hdc, cxClient / 2, cyClient / 2, NULL);Ellipse(hdc, -30, 30, 30, -30);

100映射到cxClient,cyClient.
画出来的是圆,随着窗口的变化依然是一个圆。
2,各向异性 MM_ANISOTROPIC

SetMapMode(hdc, MM_ISOTROPIC);SetWindowExtEx(hdc, 200, 300, NULL);SetViewportExtEx(hdc, cxClient, cyClient,NULL);SetViewportOrgEx(hdc, cxClient / 2, cyClient / 2, NULL);Ellipse(hdc, -30, 30, 30, -30);

200对应cxClient,300对于cyClient.
即客户区的宽度表示200,客户的高度表示300,通过调整窗口的比例可以得到圆,否则大部分是椭圆。

0 0
原创粉丝点击