在 QB45 中设置光标

Set cursor in QB45

我一直在使用下面的代码来改变QB45中的光标:

SUB LocateX(Inserting)
    ' locate cursor
    IF Inserting THEN
       ' half-block cursor
       Locate Xcoor, Ycoor, 1, 3, 7
    ELSE
       ' underline cursor
       Locate Xcoor, Ycoor, 1, 7, 7
    END IF
END SUB

但我想要的是一种设置光标颜色和光标闪烁率的方法..

感谢您的帮助。

QB64 中存在解决方案,而在 QB45 中,在我看来,除了使用 ANSI 编码外别无选择(也许在逆向计算中有人可以知道写入光标颜色的可能内存地址)。

如果您打算将颜色代码 7 专用于光标或与光标具有相同颜色的符号,则此解决方案(如以下代码所示)可能有效。

这里是代码:

SCREEN 0
LOCATE 1, 1, 1, 3, 7
COLOR 15
PRINT "Cursor is gray [hit a key]"
K$ = INPUT$(1)
_PALETTECOLOR 7, &HFFDAA520 ' FF alpha makes the color translucent
PRINT "Cursor is now Goldenrod! [hit a key]"
K$ = INPUT$(1)
COLOR 7
PRINT "... also text with color 7 is Goldenrod!!! [hit a key to end]";
K$ = INPUT$(1)