18. Utilisation du Yocto-MaxiDisplay en VisualBasic .NET
h
= disp.get_displayHeight()
REM
reteive the first layer
l0
= disp.get_displayLayer(0)
REM
display a text
l0.drawText(CInt(w
REM
visualize
l0.moveTo(0,
5)
l0.lineTo(0,
0)
l0.lineTo(5,
0)
l0.moveTo(0, h
l0.lineTo(0, h
l0.lineTo(5, h
l0.moveTo(w
-
l0.lineTo(w
-
l0.lineTo(w
-
l0.moveTo(w
-
l0.lineTo(w
-
l0.lineTo(w
-
REM
draw a circle
l1
= disp.get_displayLayer(1)
l1.clear()
l1.drawCircle(CInt(h
REM and
animate the layer
Console.WriteLine("Use Ctrl-C to
x
=
0
y
=
0
vx
=
1
vy
=
1
While (disp.isOnline())
x
+=
vx
y
+=
vy
If
((x
< 0) Or
If
((y
< 0) Or
l1.setLayerPosition(x, y,
YAPI.Sleep(5,
End While
YAPI.FreeAPI()
End Sub
End Module
18.4. Contrôle de la partie module
Chaque module peut-être contrôlé d'une manière similaire, vous trouverez ci dessous un simple
programme d'exemple affichant les principaux paramètres d'un module et permettant d'activer la
balise de localisation.
Imports
System.IO
Imports
System.Environment
Module
Module1
Sub usage()
Console.WriteLine("usage: demo <serial or logical name>
End
End Sub
Sub Main()
Dim argv() As
Dim
errmsg
As
Dim
m
As
ymodule
If
(YAPI.RegisterHub("usb",
Console.WriteLine("RegisterHub error:"
End
End If
140
in
the middle
of
/
2), CInt(h
/
2), Y_ALIGN.CENTER,
each
corner
- 6)
- 1)
- 1)
1, h
- 6)
1, h
- 1)
6, h
- 1)
1,
5)
1,
0)
6,
0)
in
the top left corner
/
8), CInt(h
/
stop")
(x
>
w
-
(h
/ 4))) Then
(y
>
h
-
(h
/ 4))) Then
0)
errmsg)
String
= System.Environment.GetCommandLineArgs()
String
=
""
errmsg) <> YAPI_SUCCESS) Then
the screen
"Hello
of
layer
1
8), CInt(h
/ 8))
vx
=
-vx
vy
=
-vy
[ON/OFF]")
+ errmsg)
world!")
www.yoctopuce.com