SCREENCOPY
- 来源: https://www.freebasic.net/wiki/wikka.php?wakka=KeyPgScreencopy
- 最后更新: 2023-07-09
将一个图形页面的内容复制到另一个图形页面
语法
declare function Screencopy ( byval from_page as long = -1, byval to_page as long = -1 ) as long用法
Screencopy [ from_page ] [, to_page ]参数
from_page
要复制的源页面
to_page
目标页面
返回值
成功时返回零(0),失败时返回非零错误代码。
说明
from_page 是要复制的页面。如果省略此参数,假定为当前工作页面。to_page 是要复制到的页面。如果省略此参数,假定为当前可见页面。页面编号范围为 0 到 num_pages - 1,其中 num_pages 是使用 Screenres 或 Screen (Graphics) 设置图形模式时指定的页面数。
可以使用此函数为图形添加双缓冲。任何具有多个页面的图形屏幕模式都支持此函数。
如果目标页面被锁定,Screencopy 不起作用。
还有两个类似的函数:Flip 和 PCopy。Flip 设计用于 OpenGL 模式,而 PCopy 在某些平台上支持控制台页面。在普通图形模式下,两者的功能与 Screencopy 相同。
Screencopy 返回的错误代码可以在下一行使用 Err 检查。Screencopy 的函数版本直接将错误代码作为 32 位 Long 返回。
示例
另见 Screenset 示例。
start GeSHi
vb
'' 320x200x8, with 3 pages
Screen 13,,3
'' image for working page #1 (visible page #0)
ScreenSet 1, 0
Cls
Circle( 160, 100 ), 90, 1 ,,,, f
Circle( 160, 100 ), 90, 15
Print "Press 2 to copy page #2 to visible page"
Print "Press escape to exit"
'' image for working page #2 (visible page #0)
ScreenSet 2, 0
Cls
Line( 50, 50 )-( 270, 150 ), 2, bf
Line( 50, 50 )-( 270, 150 ), 15, b
Print "Press 1 to copy page #1 to visible page"
Print "Press escape to exit"
'' page #0 is the working page (visible page #0)
ScreenSet 0, 0
Cls
Print "Press 1 to copy page #1 to visible page"
Print "Press 2 to copy page #2 to visible page"
Print "Press escape to exit"
Dim k As String
Do
k = Inkey
Select Case k
Case Chr(27)
Exit Do
Case "1"
ScreenCopy 1, 0
Case "2"
ScreenCopy 2, 0
End Select
Sleep 25
Loopend GeSHi
方言差异
- 在 -lang qb 方言中不可用,除非使用别名
__Screencopy引用。
与 QB 的区别
- FreeBASIC 新增。它是
Pcopy的纯图形版本——Pcopy同时在文本和图形模式下工作。
另请参阅
PcopyScreen (Graphics)ScreenresScreenset
返回 目录