The following code example demonstrate the use of tab_control and colored tab_page containers.
#include <xtd/xtd>
using namespace std;
class form1 :
public form {
public:
form1() {
text("Colored Tab pages example");
controls().push_back(tab_control_colored);
image_list_.image_size({16, 16});
auto bitmap = drawing::bitmap(image_list_.image_size());
auto graphics = drawing::graphics::from_image(bitmap);
graphics.fill_ellipse(solid_brush(color), 0, 0, bitmap.width(), bitmap.height());
graphics.draw_ellipse(pens::black(), 0, 0, bitmap.width() - 1, bitmap.height() - 1);
image_list_.images().push_back(bitmap);
auto tab_page = control::create<forms::tab_page>(tab_control_colored, color.name(), drawing::point::empty, drawing::size::empty, color);
tab_page->image_index(tab_pages.size());
tab_pages.push_back(move(tab_page));
});
tab_control_colored.image_list(image_list_);
tab_control_colored.dock(dock_style::fill);
tab_control_colored.alignment(tab_alignment::bottom);
}
private:
vector<color>
colors = {colors::light_pink(), colors::light_green(), colors::light_blue(), colors::light_yellow()};
vector<shared_ptr<tab_page>> tab_pages;
};
int main() {
application::run(form1());
}
Represents an ARGB (alpha, red, green, blue) color.
Definition: color.h:39
colors for all the standard colors. This class cannot be inherited.
Definition: colors.h:20
size_t size
Represents a size of any object in bytes.
Definition: types.h:171
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition: bitmap.h:11
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17