Skip to content

SCREENSET


设置当前工作页面和可见页面

语法

declare sub Screenset ( byval work_page as long = -1, byval visible_page as long = -1 )

用法

Screenset [ work_page ] [, visible_page ]

参数

work_page

工作页面索引

visible_page

可见页面索引

说明

Screenset 允许设置当前工作页面和当前可见页面。页面编号范围为 0num_pages - 1,其中 num_pages 是使用 ScreenresScreen (Graphics) 设置图形模式时指定的页面数。可以使用此函数实现页面翻转或双缓冲。

如果提供 visible_page 但省略 work_page,只更改可见页面。如果提供 work_page 但省略 visible_page,只更改工作页面。如果省略两个参数,工作页面和可见页面都重置为页面 0。

Screenset 提供了一种向屏幕写入而不立即向用户显示更改的方法。另见 Screenlock / Screenunlock 作为实现此功能的替代方法。

注意:光标位置不会对每个视频页面独立处理。因此,当选择另一个工作页面时,起始光标位置对应于前一个工作页面上的最后光标位置(文本光标和图形光标行为相同)。

示例

start GeSHi

vb
' Open graphics screen (320*200, 8bpp) with 2 pages
ScreenRes 320, 200, 8, 2

' Work on page 1 while displaying page 0
ScreenSet 1, 0

Dim As Integer x = -40

Do
    '' Clear the screen, draw a box, update x
    Cls
    Line (x, 80)-Step(39, 39), 4, BF
    x += 1: If (x > 319) Then x = -40
   
    ' Wait for vertical sync: only used to control refresh rate, can be put anywhere in the Do loop
    ScreenSync
   
    ' Copy work page to visible page
    ScreenCopy
   
Loop While Inkey = ""

end GeSHi

方言差异

  • -lang qb 方言中不可用,除非使用别名 __Screenset 引用。

与 QB 的区别

  • FreeBASIC 新增

另请参阅

  • Screen (Graphics)
  • Screenres
  • Screencopy
  • Screenlock
  • Screenunlock

返回 目录

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