Sub DrawBreadboardHoles
GraphicsWindow.BrushColor = "Black"
size = 1
width = size * scale
height = size * scale
dx = 2.8 * scale
dy = 2.8 * scale
For row = 1 To 18
y = (oy + 3) * scale + (row - 1) * dy
If row = 3 Or row = 9 Or row = 10 Or row = 16 Then
Else
For col = 1 To 63
If row = 1 Or row = 2 Or row = 17 Or row = 18 Then
If 3 <= col And col <= 61 And Math.Remainder(col, 6) <> 2 Then
skip = "False"
Else
skip = "True"
EndIf
Else
skip = "False"
EndIf
If Not[skip] Then
x = (ox + 3) * scale + (col - 1) * dx
GraphicsWindow.FillRectangle(x, y, width, height)
EndIf
EndFor
EndIf
EndFor
EndSub
Sub DrawHoles
' holes for connector
If i = 11 Then
holes = 10
s = symbol[1]
ElseIf i = 12 Then
holes = 8
s = symbol[2]
ElseIf i = 13 Then
holes = 8
s = symbol[3]
ElseIf i = 14 Then
holes = 6
s = symbol[4]
Else
holes = 0
EndIf
If 0 < holes Then
x = (ox + shp["x"]) * scale
y = (oy + shp["y"]) * scale
width = shp["width"] * scale
height = shp["height"] * scale
hw = (width - (holes + 1) * 3) / holes
hy = y + 3
hh = height - 6
pin = 0
For hx = x + 3 To x + width - hw - 2 Step hw + 3
GraphicsWindow.BrushColor = "Black"
GraphicsWindow.FillRectangle(hx, hy, hw, hh)
pin = pin + 1
GraphicsWindow.BrushColor = "White"
len = Text.GetLength(s[pin])
txt = Shapes.AddText(s[pin])
If i < 13 Then
Shapes.Move(txt, hx + (1.8 - len) * 2.8 - 2, hy + len * 2.4 + 8)
Else
Shapes.Move(txt, hx + (1.8 - len) * 2.8 - 2, hy - len * 2.4 - 10)
EndIf
Shapes.Rotate(txt, -90)
EndFor
EndIf
EndSub
Sub DrawRoundRect
pc = param["pc"]
x = ox + param["x"]
y = oy + param["y"]
r = param["height"] / 2
cx = x + r
cy = y + r
For a = 90 To 270 Step 10
_a = Math.GetRadians(a)
x = cx + r * Math.Cos(_a)
y = cy + r * Math.Sin(_a)
GraphicsWindow.SetPixel(x * scale, y * scale, pc)
EndFor
x1 = ox + param["x"] + r
x2 = ox + param["x"] + param["width"] - r
y1 = oy + param["y"]
y2 = oy + param["y"] + param["height"]
For x = x1 + 0.4 To x2 - 0.5 Step 0.5
GraphicsWindow.SetPixel(x * scale, y1 * scale, pc)
GraphicsWindow.SetPixel(x * scale, y2 * scale, pc)
EndFor
cx = cx + param["width"] - 2 * r
For a = -90 To 90 Step 10
_a = Math.GetRadians(a)
x = cx + r * Math.Cos(_a)
y = cy + r * Math.Sin(_a)
GraphicsWindow.SetPixel(x * scale, y * scale, pc)
EndFor
EndSub
Sub DrawWire
size = param["pw"] * scale
GraphicsWindow.PenWidth = size
GraphicsWindow.PenColor = param["pc"]
GraphicsWindow.BrushColor = param["pc"]
p = 1
points = param["points"]
len = Text.GetLength(points)
n = 0
While p <= len
sp = Text.GetIndexOf(Text.GetSubTextToEnd(points, p), " ")
If 0 < sp Then
n = n + 1
x[n] = Text.GetSubText(points, p, sp - 1) * scale
p = p + sp
Else
x[n] = Text.GetSubTextToEnd(points, p) * scale
p = len + 1
EndIf
If p <= len Then
sp = Text.GetIndexOf(Text.GetSubTextToEnd(points, p), " ")
If 0 < sp Then
y[n] = Text.GetSubText(points, p, sp - 1) * scale
p = p + sp
Else
y[n] = Text.GetSubTextToEnd(points, p) * scale
p = len + 1
EndIf
EndIf
EndWhile
GraphicsWindow.FillEllipse(x[1] - size / 2, y[1] - size / 2, size, size)
For i = 2 To n
GraphicsWindow.DrawLine(x[i - 1], y[i - 1], x[i], y[i])
GraphicsWindow.FillEllipse(x[i] - size / 2, y[i] - size / 2, size, size)
EndFor
EndSub
Sub Init
Not = "False=True;True=False;"
gw = 598
gh = 428
GraphicsWindow.Width = gw
GraphicsWindow.Height = gh
url = Program.Directory + "\IMG_0045.JPG"
url = ""
img = ImageList.LoadImage(url)
iw = ImageList.GetWidthOfImage(img)
ih = ImageList.GetHeightOfImage(img)
x = -92.5
y = 0
scale = 0.135
width = iw * scale
height = ih * scale
photo = Shapes.AddImage(img)
Shapes.Move(photo, x - iw / 2 + width / 2, y - ih / 2 + height / 2)
Shapes.Zoom(photo, scale, scale)
Shapes.SetOpacity(photo, 50)
EndSub