#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/form>
#include <xtd/forms/label>
namespace timer_example {
class form1 :
public form {
public:
form1() {
label1.location({10, 10});
label1.auto_size(true);
label1.fore_color(color::dodger_blue);
button1.parent(*this);
button1.text("Start");
button1.location({10, 90});
button1.click += [&](
object & sender,
const event_args & e) {
timer1.enabled(!timer1.enabled());
button1.text(timer1.enabled() ? "Stop" : "Start");
};
timer1.interval(100_ms);
timer1.tick += [&](
object & sender,
const event_args & e) {
label1.text(string::format("{:F1}", ++counter / 10.0));
};
text("Timer example");
client_size({230, 130});
}
private:
int counter = 0;
};
}
auto main() -> int {
application::run(timer_example::form1 {});
}
Defines a particular format for text, including font face, size, and style attributes....
Definition font.h:45
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.h:18
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition brush.h:18
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10