demonstrates the use of xtd::forms::font_box font dialog.
- Windows
-
- macOS
-
- Gnome
-
#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/font_box>
#include <xtd/forms/form>
#include <xtd/forms/message_box>
#include <xtd/forms/label>
class form1 :
public form {
public:
form1() {
text(
"Font box example");
client_size({220, 160});
controls().push_back_range({button_font, button_font_and_color});
button_font.parent(*this)
.location({10, 10})
.size({200, 45})
.click += [this] {
auto res = font_box::show(
font, *
this);
if (res == dialog_result::ok)
};
button_font_and_color.parent(*this)
.location({10, 60})
.
text(
"Select a font and a font color")
.size({200, 45})
.click += [] {
auto res = font_box::show(font, color, font_box_options::show_color);
if (res == dialog_result::ok)
message_box::show(
ustring::format(
"Selected font is: {}\ncolor: {}", font, color));
};
}
private:
};
auto main()->int {
application::run(form1 {});
}