xtd - Reference Guide  0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
lcd_label2.cpp

The following code example demonstrate the use of lcd_label control.

Windows

macOS

Gnome

#include <xtd/xtd>
using namespace std::literals;
using namespace xtd;
using namespace xtd::drawing;
using namespace xtd::forms;
int main() {
auto counter = 0;
timer timer;
timer.interval(100ms);
form form_main;
form_main.text("Lcd label example 2");
form_main.start_position(form_start_position::center_screen);
form_main.auto_size_mode(forms::auto_size_mode::grow_and_shrink);
form_main.client_size({1456, 503});
lcd_label label;
label.parent(form_main);
label.dock(dock_style::fill);
label.fore_color(color::blue);
label.back_color(color::average(color::black, label.fore_color(), 0.05));
label.text(" 0.0");
timer.tick += [&] {
label.text(ustring::format("{,5:F1}", counter++ / 10.0));
};
label.mouse_down += [&] {
if (control::mouse_buttons() == mouse_buttons::left)
timer.enabled(!timer.enabled());
else {
counter = 0;
label.text(" 0.0");
}
};
application::run(form_main);
}
mouse_buttons
Specifies constants that define which mouse button was pressed. This enumeration has a flag attribute...
Definition: mouse_buttons.h:18
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition: bitmap.h:11
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17