| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 676 人关注过本帖
标题:关于VISTA下世界坐标的转换问题!!!请高手指点,谢谢了!!!
只看楼主 加入收藏
strick
Rank: 2
来 自:天津市
等 级:论坛游民
帖 子:10
专家分:16
注 册:2009-11-8
结帖率:100%
收藏
 问题点数:0 回复次数:0 
关于VISTA下世界坐标的转换问题!!!请高手指点,谢谢了!!!
我写了一段关于世界坐标转换的代码,用了API,但是实现不了矩形的旋转,是不是VISTA下不能用世界坐标的转换啊?急需高手解答,谢谢了啊!!


Private Declare Function SetGraphicsMode Lib "gdi32" (ByVal hdc As Long, ByVal iMode As Long) As Long
Private Declare Function SetWorldTransform Lib "gdi32" (ByVal hdc As Long, lpXform As XFORM) As Long
Private Declare Function Rectangle Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Type XFORM
        eM11 As Double
        eM12 As Double
        eM21 As Double
        eM22 As Double
        eDx As Double
        eDy As Double
End Type

Private Sub Form_Paint()
Dim tempXForm As XFORM
Dim r As Long
Const twopi = 6.28318
'设置图形模式为增强的模式(允许世界坐标的转换)
r = SetGraphicsMode(hdc, GM_ADVANCED)
'在VGA的屏幕上世界定义坐标变换(坐标在半周内逆时针旋转依次旋转45°)
For i = 0 To 180 Step 45
tempXForm.eM11 = Cos(i * twopi / 360)
tempXForm.eM12 = -Sin(i * twopi / 360)
tempXForm.eM21 = Sin(i * twopi / 360)
tempXForm.eM22 = Cos(i * twopi / 360)
tempXForm.eDx = 640 / 2
tempXForm.eDy = 480 / 2
'这是旋转转换公式,详情见同一文件夹下的TXT文档。
r = SetWorldTransform(hdc, tempXForm)
'画适合VGA屏幕的矩形
r = Rectangle(hdc, 640 / 4, 480 / 4, 1280 / 4, 960 / 4)
Next i
End Sub
搜索更多相关主题的帖子: 坐标 VISTA 世界 
2009-11-09 22:19
快速回复:关于VISTA下世界坐标的转换问题!!!请高手指点,谢谢了!!!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.028904 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved