#include <xtd/drawing/colors>
#include <xtd/drawing/pens>
#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/tab_control>
#include <xtd/forms/tab_page>
#include <xtd/cdebug>
using namespace std;
class form1 :
public form {
public:
form1() {
text("Colored Tab pages example");
controls().push_back(colored_tab_control);
color_image_list.image_size({16, 16});
for(
auto color : {colors::light_pink(), colors::light_green(), colors::light_blue(), colors::light_yellow()}) {
color_image_list.images().push_back(image_from_color(color_image_list.image_size(),
color));
auto colored_tab_page = make_unique<forms::tab_page>();
colored_tab_page->image_index(colored_tab_pages.size()).parent(colored_tab_control).text(
color.
name()).back_color(
color);
colored_tab_pages.push_back(std::move(colored_tab_page));
};
colored_tab_control.image_list(color_image_list);
colored_tab_control.dock(dock_style::fill);
colored_tab_control.alignment(tab_alignment::bottom);
}
private:
auto g = graphics::from_image(colored_bitmap);
g.fill_ellipse(
solid_brush {
color}, 0, 0, colored_bitmap.width(), colored_bitmap.height());
g.draw_ellipse(pens::black(), 0, 0, colored_bitmap.width() - 1, colored_bitmap.height() - 1);
return colored_bitmap;
}
vector<unique_ptr<tab_page>> colored_tab_pages;
};
auto main()->int {
application::run(form1 {});
}
Encapsulates a GDI+ bitmap, which consists of the pixel data for a graphics image and its attributes....
Definition bitmap.h:26
Represents an ARGB (alpha, red, green, blue) color.
Definition color.h:49
xtd::ustring name() const noexcept
Gets the name of this xtd::drawing::color.
Stores an ordered pair of integers, which specify a height and width.
Definition size.h:31
Defines a xtd::drawing::brush of a single color. Brushes are used to fill graphics shapes,...
Definition solid_brush.h:30
size_t size
Represents a size of any object in bytes.
Definition types.h:197
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.h:11
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10