このプログラムは画面上に点を打ちます。小さな ● と × の両方を使ってみました。 方眼線の色も変えてみました。
Small Basic オンラインで実行したスクリーンショットを以下に示します。 座標 (100, 100) と座標 (200, 100) に点を打っています。
● も × も Small Basic では左上の座標を指定します。示したい点の座標をそのまま指定すると、 座標の右下に図形が来てしまうので、図形のサイズの半分だけ左上にずらす必要があります。
' Points Sample
' Version 0.1.0
' Copyright © 2020 Nonki Takahshi. The MIT License.
' Last update 2020-08-21
DrawGrid()
' draw point with a circle
x = 100
y = 100
size = 10
GraphicsWindow.BrushColor = "Red"
GraphicsWindow.FillEllipse(x - size / 2, y - size / 2, size, size)
' draw point with a cross
x = 200
y = 100
GraphicsWindow.PenColor = "Black"
GraphicsWindow.DrawLine(x - size / 2, y - size / 2, x + size / 2, y + size / 2)
GraphicsWindow.DrawLine(x - size / 2, y + size / 2, x + size / 2, y - size / 2)
Sub DrawGrid
gw = GraphicsWindow.Width
gh = GraphicsWindow.Height
fn = GraphicsWindow.FontName
If (fn = "Tahoma") Or (fn = "Segoe UI") Then
c10 = "#33000000"
c100 = "#66000000"
Else ' for SBO
c10 = "#00000033"
c100 = "#00000066"
EndIf
For x = 0 To gw Step 10
If Math.Remainder(x, 100) = 0 Then
GraphicsWindow.PenColor = c100
Else
GraphicsWindow.PenColor = c10
EndIf
GraphicsWindow.DrawLine(x, 0, x, gh)
EndFor
For y = 0 To gh Step 10
If Math.Remainder(y, 100) = 0 Then
GraphicsWindow.PenColor = c100
Else
GraphicsWindow.PenColor = c10
EndIf
GraphicsWindow.DrawLine(0, y, gw, y)
EndFor
EndSub