xtd - Reference Guide  0.1.2
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
settings_example.cpp

The following code example demonstrate the use of settings class.

Windows

macOS

Gnome

#include <xtd/xtd>
#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->client_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->client_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);
}
Stores an ordered pair of integers, which specify a height and width.
Definition size.h:25
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition bitmap.h:11
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition about_box.h:13