This repository was archived by the owner on Jan 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtoggle_button.cpp
More file actions
49 lines (42 loc) · 1.46 KB
/
Copy pathtoggle_button.cpp
File metadata and controls
49 lines (42 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <xtd/xtd.forms>
using namespace xtd;
using namespace xtd::forms;
namespace examples {
class form1 : public form {
public:
form1() {
text("Toggle button example");
controls().push_back_range({toggle_button1, toggle_button2, toggle_button3});
toggle_button1.auto_check(false);
toggle_button1.click += [&] {
//toggle_button1.checked(!toggle_button1.checked());
toggle_button1.text(strings::format("{}", toggle_button1.check_state()));
};
toggle_button1.location({30, 30});
toggle_button1.text(strings::format("{}", toggle_button1.check_state()));
toggle_button1.width(120);
toggle_button2.check_state_changed += [&] {
toggle_button2.text(strings::format("{}", toggle_button2.check_state()));
};
toggle_button2.checked(true);
toggle_button2.location({30, 60});
toggle_button2.width(120);
toggle_button3.auto_size(true);
toggle_button3.check_state_changed += [&] {
toggle_button3.text(strings::format("{}", toggle_button3.check_state()));
};
toggle_button3.check_state(forms::check_state::indeterminate);
toggle_button3.three_state(true);
toggle_button3.location({30, 90});
toggle_button3.width(120);
}
private:
toggle_button toggle_button1;
toggle_button toggle_button2;
toggle_button toggle_button3;
};
}
int main() {
application::enable_visual_styles();
application::run(examples::form1());
}