![Yoctopuce Yocto-Display User Manual Download Page 87](http://html1.mh-extra.com/html/yoctopuce/yocto-display/yocto-display_user-manual_3418946087.webp)
get_displayLayer
The
get_displayLayer()
method of the object returned by
YDisplay.FindDisplay
allows
you to retrieve the object corresponding to one of the screen layers. This object implements all the
graphical routines.
A real example
Launch Microsoft Visual C# and open the corresponding sample project provided in the directory
Examples/Doc-GettingStarted-Yocto-Display
of the Yoctopuce library.
In this example, you will recognize the functions explained above, but this time used with all side
materials needed to make it work nicely as a small demo.
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
ConsoleApplication1
{
class
Program
{
static
void
usage
()
{
string
execname
=
System
.
AppDomain
.
CurrentDomain
.
FriendlyName
;
Console
.
WriteLine
(
execname
+
" <serial_number> "
);
Console
.
WriteLine
(
execname
+
" <logical_name>"
);
Console
.
WriteLine
(
execname
+
" any "
);
System.
Threading
.
Thread
.
Sleep
(
2500
);
Environment
.
Exit
(
0
);
}
static
void
Main
(
string
[]
args
)
{
string
errmsg
=
""
;
string
target
;
YDisplay
disp
;
YDisplayLayer
l0, l1
;
int
h, w, y, x, vx, vy
;
if
(
args
.
Length
<
1
)
usage
();
target
=
args
[
0
].
ToUpper
();
// API init
if
(
YAPI
.
RegisterHub
(
"usb"
,
ref
errmsg
)
!=
YAPI
.
SUCCESS
)
{
Console
.
WriteLine
(
"RegisterHub error: "
+
errmsg
);
Environment
.
Exit
(
0
);
}
// find the display according to command line parameters
if
(
target
==
"ANY"
)
{
disp
=
YDisplay
.
FirstDisplay
();
if
(
disp
==
null)
{
Console
.
WriteLine
(
"No module connected (check USB cable) "
);
Environment
.
Exit
(
0
);
}
}
else
disp
=
YDisplay
.
FindDisplay
(
target
+
".display"
);
if
(!
disp
.
isOnline
())
{
Console
.
WriteLine
(
"Module not connected (check identification and USB cable) "
);
Environment
.
Exit
(
0
);
}
//clean up
disp
.
resetAll
();
// retreive the display size
w
=
disp
.
get_displayWidth
();
h
=
disp
.
get_displayHeight
();
// reteive the first layer
l0
=
disp
.
get_displayLayer
(
0
);
// display a text in the middle of the screen
14. Using Yocto-Display with C#
www.yoctopuce.com
81
Summary of Contents for Yocto-Display
Page 1: ...Yocto Display User Manual...
Page 2: ......
Page 40: ...34 www yoctopuce com...
Page 52: ...46 www yoctopuce com...
Page 84: ...78 www yoctopuce com...
Page 92: ...86 www yoctopuce com...
Page 130: ...124 www yoctopuce com...
Page 422: ...416 www yoctopuce com...