xtd 0.2.0
Loading...
Searching...
No Matches
hello_world_paint.cpp

The classic first application "Hello, World!" with GDI+ drawing objects.

Windows

macOS

Gnome

#include <xtd/xtd>
using namespace xtd;
using namespace xtd::drawing;
using namespace xtd::forms;
namespace hello_world_paint_example {
class main_form : public form {
public:
main_form() {
text("Hello world (paint)");
client_size({300, 300});
paint += [&](object& sender, paint_event_args& e) {
e.graphics().clear(color::light_blue);
e.graphics().draw_string("Hello, World!", {system_fonts::default_font(), 32, font_style::bold | font_style::italic}, solid_brush {color_converter::dark(color::light_blue)}, rectangle::offset(e.clip_rectangle(), {2, 2}), string_format().alignment(string_alignment::center).line_alignment(string_alignment::center));
e.graphics().draw_string("Hello, World!", {system_fonts::default_font(), 32, font_style::bold | font_style::italic}, brushes::dark_blue(), rectangle::inflate(e.clip_rectangle(), {-2, -2}), string_format().alignment(string_alignment::center).line_alignment(string_alignment::center));
};
}
};
}
auto main() -> int {
application::run(hello_world_paint_example::main_form());
}
Defines a xtd::drawing::brush of a single color. Brushes are used to fill graphics shapes,...
Definition solid_brush.h:30
Encapsulates text layout information (such as alignment, orientation and tab stops) display manipulat...
Definition string_format.h:30
xtd::drawing::string_alignment alignment() const noexcept
Gets horizontal alignment of the string.
Represents a window or dialog box that makes up an application's user interface.
Definition form.h:54
Provides data for the xtd::forms::control::paint event.
Definition paint_event_args.h:30
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition brush.h:18
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.h:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10