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

demonstrates how to create a custom control with xtd::forms::user_control control.

Windows

macOS

Gnome

#include <xtd/drawing/system_colors>
#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/user_control>
using namespace xtd;
using namespace xtd::forms;
namespace line_example {
class colored_line : public user_control {
public:
void color(const drawing::color& color) {back_color(color);}
drawing::color color() const {return back_color();}
};
class form1 : public form {
public:
form1() {
line_separator.color(drawing::system_colors::window());
line_separator.bounds({10, 10, 280, 2});
line_red.color(drawing::color::red);
line_red.bounds({10, 20, 2, 250});
line_green.color(drawing::color::green);
line_green.bounds({149, 20, 2, 250});
line_blue.color(drawing::color::blue);
line_blue.bounds({288, 20, 2, 250});
line_separator2.color(drawing::system_colors::control_text());
line_separator2.bounds({10, 278, 280, 2});
text("Lines example");
client_size({300, 300});
controls().push_back_range({line_separator, line_red, line_green, line_blue, line_separator2});
}
private:
colored_line line_separator;
colored_line line_red;
colored_line line_green;
colored_line line_blue;
colored_line line_separator2;
};
}
auto main() -> int {
application::run(line_example::form1 {});
}
Represents an ARGB (alpha, red, green, blue) color.
Definition color.h:49
virtual drawing::rectangle bounds() const noexcept
Gets the size and location of the control including its nonclient elements, in pixels,...
Represents a window or dialog box that makes up an application's user interface.
Definition form.h:54
Represents a standard Windows user control.
Definition user_control.h:27
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