#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/images>
#include <xtd/math>
class form_main :
public form {
public:
form_main() {
text("Draw image example");
}
protected:
form::on_paint(e);
auto image_size = math::min(e.clip_rectangle().width(), e.clip_rectangle().height());
auto image_rect =
rectangle((e.clip_rectangle().width() - image_size) / 2, (e.clip_rectangle().height() - image_size) / 2, image_size, image_size);
e.graphics().draw_image(
image, image_rect);
}
private:
};
auto main() -> int {
application::run(form_main());
}
An abstract base class that provides functionality for the bitmap and metafile descended classes.
Definition image.hpp:49
Stores a set of four integers that represent the location and size of a rectangle.
Definition rectangle.hpp:44
Stores an ordered pair of integers, which specify a height and width.
Definition size.hpp:31
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition brush.hpp:18
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10