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 pathsettings_example.cpp
More file actions
42 lines (34 loc) · 1.81 KB
/
Copy pathsettings_example.cpp
File metadata and controls
42 lines (34 loc) · 1.81 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
#include <xtd/xtd.forms>
#include "../properties/settings.h"
using namespace xtd::drawing;
using namespace xtd::forms;
int main() {
auto main_form = control::create<form>(settings_example::properties::settings::default_settings().text());
main_form->start_position(form_start_position::manual);
auto back_color_picker = control::create<color_picker>(*main_form, "", {10, 10}, {75, 25});
back_color_picker->color_changed += [&] {
main_form->back_color(back_color_picker->color());
};
auto save_button = control::create<button>(*main_form, "&Save", {90, 10});
save_button->click += [&] {
settings_example::properties::settings::default_settings().size(main_form->size());
settings_example::properties::settings::default_settings().location(main_form->location());
settings_example::properties::settings::default_settings().back_color(main_form->back_color());
settings_example::properties::settings::default_settings().save();
};
auto reload_button = control::create<button>(*main_form, "&Reload", {170, 10});
reload_button->click += [&] {
settings_example::properties::settings::default_settings().reload();
main_form->size(settings_example::properties::settings::default_settings().size());
main_form->location(settings_example::properties::settings::default_settings().location());
main_form->back_color(settings_example::properties::settings::default_settings().back_color());
back_color_picker->color(settings_example::properties::settings::default_settings().back_color());
};
auto reset_button = control::create<button>(*main_form, "R&eset", {250, 10});
reset_button->click += [&] {
settings_example::properties::settings::default_settings().reset();
reload_button->perform_click();
};
reload_button->perform_click();
application::run(*main_form);
}