#include <xtd/drawing/color_converter>
#include <xtd/drawing/colors>
#include <xtd/drawing/system_colors>
#include <xtd/forms/application>
#include <xtd/forms/choice>
#include <xtd/forms/form>
#include <xtd/forms/label>
#include <xtd/forms/panel>
#include <xtd/forms/toggle_button>
#include <xtd/startup>
namespace border_style_example {
class form1 :
public form {
public:
static auto main() {
}
form1() {
text(
"Border style example");
client_size({700, 170 +
as<int>(20 + bordered_labels.size() / 4 * 70)});
controls().push_back_range({colored_panel, control_panel});
maximize_box(false);
colored_panel.controls().push_back_range(bordered_labels);
for (auto index = 0ul; index < bordered_labels.size(); ++index) {
bordered_labels[index].border_style(border_styles[index]);
}
control_panel.controls().push_back_range({choose_color_label, colors_chooser, select_sides_label, top_side, left_side, bottom_side, right_side});
choose_color_label.auto_size(true);
choose_color_label.location({20, 40});
choose_color_label.text("Choose color");
colors_chooser.bounds({120, 37, 220, colors_chooser.size().height});
colors_chooser.selected_index_changed += [&] {
colored_panel.back_color(colors_chooser.selected_item() ==
"control" ?
color :
color.
is_dark() ? color_converter::light(
color, .1) : color_converter::dark(
color, .1));
colored_panel.fore_color(
color.
is_dark() ? color_converter::light(
color, 2.0 / 3) : color_converter::dark(
color, 2.0 / 3));
for (auto& bordered_label : bordered_labels)
bordered_label.back_color(
color);
};
colors_chooser.selected_item("control");
select_sides_label.auto_size(true);
select_sides_label.location({380, 40});
select_sides_label.text("Select sides");
top_side.checked(true);
top_side.checked(true);
top_side.location({495, 15});
top_side.size({50, 10});
top_side.checked_changed += [&] {
for (auto& bordered_label : bordered_labels)
};
left_side.checked(true);
left_side.location({480, 25});
left_side.size({10, 50});
left_side.checked_changed += [&] {
for (auto& bordered_label : bordered_labels)
};
right_side.checked(true);
right_side.location({550, 25});
right_side.size({10, 50});
right_side.checked_changed += [&] {
for (auto& bordered_label : bordered_labels)
};
bottom_side.checked(true);
bottom_side.location({495, 75});
bottom_side.size({50, 10});
bottom_side.checked_changed += [&] {
for (auto& bordered_label : bordered_labels)
};
}
private:
inline static const list<border_style> border_styles {
border_style::none,
border_style::solid,
border_style::inset,
border_style::outset,
border_style::groove,
border_style::ridge,
border_style::theme,
border_style::dashed,
border_style::dot_dash,
border_style::dot_dot_dash,
border_style::dotted,
border_style::double_border,
border_style::bevel_inset,
border_style::bevel_outset,
border_style::rounded};
label choose_color_label;
label select_sides_label;
};
}
startup_(border_style_example::form1::main);
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.hpp:80
static string to_string(std::any value)
Convert std::any to string.
Represents an ARGB (alpha, red, green, blue) color.
Definition color.hpp:46
static xtd::drawing::color from_name(const xtd::string &name) noexcept
Creates a xtd::drawing::color class from the specified name of a predefined color.
bool is_dark() const noexcept
Gets a value indicating wheter this xtd::drawing::color structure is dark color.
static const xtd::array< xtd::string > & get_color_names() noexcept
Gets an array of color names.
Each property of the xtd::drawing::system_colors class is a xtd::drawing::color structure that is the...
Definition system_colors.hpp:25
static const xtd::array< xtd::string > & get_color_names() noexcept
Gets an array of system color names.
@ accent
The system-defined color of the accent color (macos specific. On other platform is same as menu_highl...
Definition known_color.hpp:431
#define startup_(main_method)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.hpp:167
type_t as(any_object &o)
Casts a type into another type.
Definition __as_any_object.hpp:59
The xtd::collections::generic namespace contains interfaces and classes that define generic collectio...
Definition comparer.hpp:16
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
Contains classes that represent ASCII and Unicode character encodings; abstract base classes for conv...
Definition basic_string_builder.hpp:16
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Stores a set of four integers that represent the location and size of a rectangle.
Definition rectangle.hpp:44