#include <xtd/drawing/system_colors>
#include <xtd/drawing/texts>
#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/button_images>
#include <xtd/forms/choice>
#include <xtd/forms/form>
#include <xtd/forms/images>
#include <xtd/forms/label>
#include <xtd/forms/picture_box>
namespace example {
class form1 :
public form {
public:
form1() {
text(
"Images 3 example");
client_size({676, 350});
controls().push_back_range({choice_theme, choice_context, picture_16, picture_32, picture_64, picture_128, picture_256, label_picture_name, button_previous, button_next});
choice_theme.location({10, 10});
choice_theme.width(323);
choice_theme.items().push_back("current theme");
sort(names.begin(), names.end());
choice_theme.items().push_back_range(names);
choice_theme.selected_index(0);
choice_theme.selected_index_changed += event_handler(*this, &form1::update_form);
choice_context.location({343, 10});
choice_context.width(323);
choice_context.selected_index(0);
choice_context.selected_index_changed += [&] {
current_image_index = 0;
update_form();
};
picture_16.bounds({10, 60, 30, 30});
picture_32.bounds({50, 60, 56, 56});
picture_64.bounds({126, 60, 88, 88});
picture_128.bounds({224, 60, 152, 152});
picture_256.bounds({386, 60, 280, 280});
label_picture_name.bounds({10, 240, 280, label_picture_name.height()});
button_previous.auto_repeat(true);
button_previous.enabled(false);
button_previous.bounds({10, 300, 125, 40});
button_previous.click += [&] {
if (current_image_index > 0) --current_image_index;
update_form();
};
button_next.auto_repeat(true);
button_next.bounds({165, 300, 125, 40});
button_next.click += [&] {
if (current_image_index <
images::names(choice_context.selected_item().value()).size()) ++current_image_index;
update_form();
};
update_form();
}
private:
void update_form() {
label_picture_name.text(
images::names(choice_context.selected_item().value())[current_image_index]);
button_previous.enabled(current_image_index > 0);
button_next.enabled(current_image_index <
images::names(choice_context.selected_item().value()).size() - 1);
}
size_t current_image_index = 0;
label label_picture_name;
};
}
auto main() -> int {
}
static xtd::drawing::color window()
Gets a xtd::drawing::color structure that is the color of the background in the client area of a wind...
static xtd::string previous()
Gets a system-defined text that has a string value of "&Previous". This field is constant.
static xtd::string next()
Gets a system-defined text that has a string value of "&Next". This field is constant.
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 an ordered pair of integers, which specify a height and width.
Definition size.hpp:31