The following code example demonstrate the use of nine segment display control.
#include <xtd/xtd>
using namespace std::literals;
class form1 :
public form {
public:
form1() {
nine_segment_display1.
height(250);
nine_segment_display1.location({(client_size().width() - nine_segment_display1.width()) / 2, (client_size().height() - nine_segment_display1.height()) / 2});
nine_segment_display1.parent(*this);
nine_segment_display1.fore_color(color::red);
nine_segment_display1.anchor(anchor_styles::top|anchor_styles::bottom);
timer1.interval(300ms);
timer1.enabled(true);
timer1.tick += [&] {
nine_segment_display1.segment_style(segment_styles[(counter / chaser.size()) % segment_styles.size()]);
nine_segment_display1.value(chaser[counter++ % chaser.size()]);
};
back_color(color::average(color::black, nine_segment_display1.fore_color(), 0.20));
text("Nine segment display example");
resize += [&] {
nine_segment_display1.left((client_size().width() - nine_segment_display1.width()) / 2);
};
}
private:
int counter = 0;
std::vector<segments> chaser = {
segments::none,
segments::a,
segments::a|segments::b,
segments::a|segments::b|segments::c,
segments::a|segments::b|segments::c|segments::d,
segments::a|segments::b|segments::c|segments::d|segments::e,
segments::a|segments::b|segments::c|segments::d|segments::e|segments::f,
segments::a|segments::b|segments::c|segments::d|segments::e|segments::f|segments::g,
segments::a|segments::b|segments::c|segments::d|segments::e|segments::f|segments::g|segments::h,
segments::a|segments::b|segments::c|segments::d|segments::e|segments::f|segments::g|segments::h|segments::i,
segments::dp,
segments::pc
};
std::vector<segment_style> segment_styles = {
segment_style::standard,
segment_style::modern,
segment_style::mixed,
segment_style::expanded,
segment_style::design,
segment_style::stick
};
};
int main() {
application::run(form1());
}
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition bitmap.h:11
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition system_report.h:17