MFC编程中SetViewportOrg与SetWindowOrg的理解
来源:互联网 发布:博时大数据100赎回 编辑:程序博客网 时间:2024/05/27 19:27
对于绘图,常常涉及到逻辑坐标与设备坐标,窗口(window)和视口(viewport)。这里有几点应该明白:窗口中的坐标都是逻辑坐标,视口中的坐标都是设备坐标。我们的绘图语句中用的坐标都是逻辑坐标。绘制的图形在设备(如显示器)上显示的过程为(1)逻辑坐标值减去逻辑坐标原点(setWindowOrg中设置的值)(2)上面的结果乘以比例因子变为设备坐标值(3)上面结果加上设备坐标原点值(setViewportOrg中设置的值)然后在设备上显示。
这里需要注意的还有几个函数,setWindowExt和setViewportExt用来设置逻辑坐标和设备坐标的比例因子和坐标轴方向,并不限制坐标范围(即逻辑坐标转换为设备坐标超出setViewportExt设置的范围只要不超出CDC对象相关的区域范围也可以显示出来)。
(1)
CRect rect(0, 0, 200, 200);
dc.rectangle(rect);
上面的语句在屏幕的最左上角绘制一个正方形;(因为此时逻辑坐标与设备坐标没有偏移)
(2)
dc.SetViewportOrg(100, 100);
CRect rect(0, 0, 200, 200);
dc.rectangle(rect);
最终我们在显示器上看到的会是一个向右下方偏移(100, 100)的一个边长为200的正方形 (3)
dc.SetWindowOrg(100, 100);
CRect rect(0, 0, 200, 200);
dc.rectangle(rect);
最终我们在显示器上看到的会是一个只有1/4个大小的矩形的一部分(事实上相当于向左上方偏移(100, 100)的一个边长为200的正方形
- [转]mfc编程中SetViewportOrg与SetWindowOrg的理解
- MFC编程中SetViewportOrg与SetWindowOrg的理解
- mfc编程中SetViewportOrg与SetWindowOrg的理解
- Windows编程中SetViewportOrg与SetWindowOrg的理解
- Windows编程中SetViewportOrg与SetWindowOrg的理解
- Windows编程中SetViewportOrg与SetWindowOrg的理解
- Windows编程中SetViewportOrg与SetWindowOrg的理解
- SetViewportOrg与SetWindowOrg的理解
- SetViewportOrg与SetWindowOrg的区别
- 对SetViewportOrg和SetWindowOrg的理解
- SetWindowExt,SetViewportExt,SetWindowOrg和SetViewportOrg的理解
- SetWindowOrg与SetViewportOrg函数的用法浅见
- SetViewportOrg与SetWindowOrg
- 理解SetWindowOrg,SetViewportOrg,SetWindowExt,SetViewportExt
- 理解SetWindowOrg,SetViewportOrg,SetWindowExt,SetViewportExt
- 理解SetWindowOrg,SetViewportOrg,SetWindowExt,SetViewportExt
- 理解SetWindowOrg,SetViewportOrg,SetWindowExt,SetViewportExt
- 理解SetWindowOrg,SetViewportOrg,SetWindowExt,SetViewportExt
- QTP日常详细函数库
- clip协议实现
- 5月编程语言排行榜:D语言风采不再
- 几种批量删除分析比较
- 北大青鸟
- MFC编程中SetViewportOrg与SetWindowOrg的理解
- 封装与信息的隐藏
- 常用的正则表达式
- 自动化测试系统的建立(转自51testing)
- C语言版本
- QTP-使用技巧(转自51testing)
- 类成员变量初始化列表(Member Initialization List)
- Dictionary Objects
- JAVA 基础IO流