xtd 0.2.0
Loading...
Searching...
No Matches
lcd_label_with_nine_segment.cpp

demonstrates how to use xtd::forms::lcd_label_with_nine_segment control.

Windows

macOS

Gnome

#include <xtd/drawing/color_converter>
#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/lcd_label>
#include <xtd/forms/timer>
using namespace xtd;
using namespace xtd::drawing;
using namespace xtd::forms;
auto main() -> int {
auto index = 0_z;
form form_main;
form_main.text("Lcd label with nine segment example");
form_main.client_size({202, 403});
label.parent(form_main);
label.dock(dock_style::fill);
label.fore_color(color::yellow);
label.back_color(color_converter::average(color::black, label.fore_color(), 0.05));
label.lcd_style(forms::lcd_style::nine_segment_display);
label.text(string::format("{}", label.valid_characters()[index]));
timer.interval(300_ms);
timer.tick += [&] {
if (++index >= label.valid_characters().size()) index = 0;
label.text(string::format("{}", label.valid_characters()[index]));
};
application::run(form_main);
}
virtual drawing::color fore_color() const noexcept
Gets the foreground color of the control.
virtual const drawing::size & client_size() const noexcept
Gets the height and width of the client area of the control.
virtual dock_style dock() const noexcept
Gets which control borders are docked to its parent control and determines how a control is resized w...
virtual drawing::color back_color() const noexcept
Gets the background color for the control.
virtual const xtd::string & text() const noexcept
Gets the text associated with this control.
virtual drawing::size size() const noexcept
Gets the height and width of the control.
virtual std::optional< control_ref > parent() const noexcept
Gets the parent container of the control.
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
Represents a standard Windows label.
Definition label.hpp:38
Represents a lcd label.
Definition lcd_label.hpp:40
Implements a timer that raises an event at user-defined intervals. This timer is optimized for use in...
Definition timer.hpp:38
virtual time_span interval() const noexcept
Gets the time, in milliseconds, before the tick event is raised relative to the last occurrence of th...
virtual bool enabled() const noexcept
Gets whether the timer is running.
event< timer, event_handler > tick
Occurs when the specified timer interval has elapsed and the timer is enabled.
Definition timer.hpp:130
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition brush.hpp:18
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.hpp:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10