xtd - Reference Guide  0.1.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
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.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});
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)
else {
counter = 0;
label.text(" 0.0");
}
};
application::run(form_main);
}
virtual const xtd::ustring & text() const
Gets the text associated with this control.
Definition: control.h:650
virtual drawing::color fore_color() const
Gets the foreground color of the control.
virtual std::optional< control_ref > parent() const
Gets the parent container of the control.
Definition: control.h:596
virtual dock_style dock() const
Gets or sets which control borders are docked to its parent control and determines how a control is r...
Definition: control.h:423
virtual drawing::color back_color() const
Gets the background color for the control.
virtual const drawing::size & client_size() const
Gets the height and width of the client area of the control.
Definition: control.h:342
Represents a window or dialog box that makes up an application's user interface.
Definition: form.h:40
virtual forms::auto_size_mode auto_size_mode() const
Gets the mode by which the form automatically resizes itself.
Definition: form.h:64
virtual form_start_position start_position() const
Gets the starting position of the form at run time.
Definition: form.h:187
Represents a standard Windows label.
Definition: label.h:26
Represents a lcd label.
Definition: lcd_label.h:31
Implements a timer that raises an event at user-defined intervals. This timer is optimized for use in...
Definition: timer.h:29
std::chrono::milliseconds interval() const
Gets the time, in milliseconds, before the tick event is raised relative to the last occurrence of th...
Definition: timer.h:53
bool enabled() const
Gets whether the timer is running.
Definition: timer.h:44
event< control, mouse_event_handler > mouse_down
Occurs when the mouse pointer is over the control and a mouse button is pressed.
Definition: control.h:1278
event< timer, event_handler > tick
Occurs when the specified timer interval has elapsed and the timer is enabled.
Definition: timer.h:80
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