shows how to fill rectangle in paint event using xtd::drawing::graphics::fill_rectangle.
- Windows
-
- macOS
-
- Gnome
-
#include <xtd/xtd>
namespace examples {
class form1 :
public form {
public:
form1() {
text(
"Fill rectangle example");
client_size({680, 340});
}
protected:
form::on_paint(e);
e.
graphics().
fill_rectangle(
linear_gradient_brush {
rectangle {180, 180, 150, 150}, back_color, fore_color, 315},
rectangle {180, 180, 150, 150});
}
private:
image create_circle_texture(
const color& fore_color,
const color& back_color) {
auto texture =
bitmap {16, 16};
auto graphics = texture.create_graphics();
return texture;
}
};
}
auto main()->int {
application::run(examples::form1 {});
}