Skip to content

POINTCOORD


在图形模式下查询 Draw 画笔位置

语法

Declare Function PointCoord( ByVal func As Long ) As Single

用法

result = PointCoord( func )

说明

PointCoord 函数可用于查询图形模式下 Draw 画笔的 x 和 y 位置。result 值取决于传递的 func 值:

func 值返回值
0x 物理坐标,等同于 PMap( PointCoord( 2 ), 0 )
1y 物理坐标,等同于 PMap( PointCoord( 3 ), 1 )
2x 视图坐标
3y 视图坐标

示例

start GeSHi

vb
Screen 12

Print "--- Default window coordinate mapping ---"
Print "DRAW pen position, at the default (0,0):"
Print "Physical:", PointCoord( 0 ), PointCoord( 1 )
Print "View:", PointCoord( 2 ), PointCoord( 3 )

Draw "BM 50,50"
Print "DRAW pen position, after being moved to (50,50):"
Print "Physical:", PointCoord( 0 ), PointCoord( 1 )
Print "View:", PointCoord( 2 ), PointCoord( 3 )

Print "--- Changing window coordinate mapping ---"
Window Screen (-100, -100) - (100, 100)

Draw "BM 0,0"
Print "DRAW pen position, after being moved to (0,0):"
Print "Physical:", PointCoord( 0 ), PointCoord( 1 )
Print "View:", PointCoord( 2 ), PointCoord( 3 )

Draw "BM 50,50"
Print "DRAW pen position, after being moved to (50,50):"
Print "Physical:", PointCoord( 0 ), PointCoord( 1 )
Print "View:", PointCoord( 2 ), PointCoord( 3 )

Sleep

end GeSHi

与 QB 的区别

  • FreeBASIC 新增

另请参阅

  • PMap
  • Window

返回 目录

基于 FreeBASIC 官方文档翻译 如有侵权请联系我们删除
FreeBASIC 是开源项目,与微软公司无隶属关系