SetMapMode
来源:互联网 发布:淘宝怎么开店 编辑:程序博客网 时间:2024/05/20 19:28
The SetMapMode function sets the mapping mode of the specified device context. The mapping mode defines the unit of measure used to transform page-space units into device-space units, and also defines the orientation of the device's x and y axes.
int SetMapMode( HDC hdc, // handle to device context int fnMapMode // new mapping mode);
Parameters
- hdc
- [in] Handle to the device context.
- fnMapMode
- [in] Specifies the new mapping mode. This parameter can be one of the following values.
Value Description MM_ANISOTROPIC Logical units are mapped to arbitrary units with arbitrarily scaled axes. Use the SetWindowExtEx and SetViewportExtEx functions to specify the units, orientation, and scaling. MM_HIENGLISH Each logical unit is mapped to 0.001 inch. Positive x is to the right; positive y is up. MM_HIMETRIC Each logical unit is mapped to 0.01 millimeter. Positive x is to the right; positive y is up. MM_ISOTROPIC Logical units are mapped to arbitrary units with equally scaled axes; that is, one unit along the x-axis is equal to one unit along the y-axis. Use the SetWindowExtEx and SetViewportExtEx functions to specify the units and the orientation of the axes. Graphics device interface (GDI) makes adjustments as necessary to ensure the x and y units remain the same size (When the window extent is set, the viewport will be adjusted to keep the units isotropic). MM_LOENGLISH Each logical unit is mapped to 0.01 inch. Positive x is to the right; positive y is up. MM_LOMETRIC Each logical unit is mapped to 0.1 millimeter. Positive x is to the right; positive y is up. MM_TEXT Each logical unit is mapped to one device pixel. Positive x is to the right; positive y is down. MM_TWIPS Each logical unit is mapped to one twentieth of a printer's point (1/1440 inch, also called a twip). Positive x is to the right; positive y is up.
Return Values
If the function succeeds, the return value identifies the previous mapping mode.
If the function fails, the return value is zero.
假设您想要一种映射方式,使点(0,0)显示在萤幕的左上角,y的值向下增长(和MM_TEXT相似),但是逻辑座标单位为1/16英寸:
SetMapMode (hdc, MM_ISOTROPIC) ;
SetWindowExtEx (hdc, 16, 16, NULL) ;//设置每16个点为一个Window-Logical-Unit
SetViewportExtEx (hdc, GetDeviceCaps (hdc, LOGPIXELSX),
GetDeviceCaps (hdc, LOGPIXELSY), NULL) ;//设置每96dpi为一个逻辑电位长度,即一英寸
因此,View中的一个逻辑单位-1英寸 = Windows中的一个逻辑长度(相当于16个点的长度),所以Window的每一个点间距1/16英寸
下面程序示范了如何将窗口逻辑坐标的x,y向象素宽度均映射为输出设备中的 1/64 英寸。
SetMapMode(hDC, MM_ISOTROPIC);
SetWindowExtEx(hDC, 64, 64, NULL);
SetViewportExtEx(hDC, GetDeviceCaps(hDC, LOGPIXELSX),
GetDeviceCaps(hDC, LOGPIXELSY), NULL); SetViewportOrgEx是设置逻辑区域坐标原点的,SetWindowOrgEx
是设置窗口在逻辑区域的显示原点位置的。比如用setviewportorgex设置原点为(100,100),setwindoworgex设置原点为(0,0)(默认,不设也可以),那你如果画一个这样的矩形(0,0,200,200),只会显示一半,这样的矩形(0,0,100,100)则不会显示。但是你用setwindoworgex设置逻辑区显示原点也为(100,100)时,则没有任何变化,当然你也可以用setwindoworgex设置成其它地方,比如(200,200),那前面那个矩形就看不见了。
- SetMapMode
- SetMapMode
- SetMapMode
- SetMapMode SetViewportExt SetVie…
- 映射模式SetMapMode
- CDC SetMapMode MM_LOENGLISH
- DC.SetMapMode()的用法记录
- SetMapMode,SetWindowOrg,SetViewportOrg,SetWindowExt,SetViewportE
- SetMapMode,SetWindowOrg,SetViewportOrg,SetWindowExt,SetViewportExt
- SetMapMode、SetWindowOrg、SetViewportOrg、SetWindowExt与SetViewportExt
- 理解SetMapMode,SetWindowOrg,SetViewportOrg,SetWindowExt,SetViewportExt
- GDI绘图中的映射模式CDC::SetMapMode()
- 理解SetMapMode,SetWindowOrg,SetViewportOrg,SetWindowExt,SetViewportExt
- 理解SetMapMode,SetWindowOrg,SetViewportOrg,SetWindowExt,SetViewportExt
- 理解SetMapMode,SetWindowOrg,SetViewportOrg,SetWindowExt,SetViewportExt
- GID映射模式MM_ISOTROPIC:SetMapMode();SetWindowOrgEx();SetViewportOrgEx();
- GDI绘图中的映射模式CDC::SetMapMode()
- SetMapMode,SetWindowExt,SetViewportExt,SetViewPortOrg函数的一些理解
- 成功其实很简单,养成十个习惯
- macro
- Linux C编程 1(原创)
- 赚钱金律100条
- 开源日志系统 - log4cplus (一)
- SetMapMode
- 如何用C语言编写幂运算的代码?救急!!!
- 开源日志系统 - log4cplus (二)
- 构造Linux流媒体服务器
- Quartz Cron Expression [摘]
- 开源日志系统 - log4cplus (三)
- Nachos虚存
- 专家分享-C#中事件处理的个人体会
- SetWindowOrg等相关函数