diff --git a/src/xtd.forms/src/xtd/forms/control_paint.cpp b/src/xtd.forms/src/xtd/forms/control_paint.cpp index 1e993934d731..d2478288788e 100644 --- a/src/xtd.forms/src/xtd/forms/control_paint.cpp +++ b/src/xtd.forms/src/xtd/forms/control_paint.cpp @@ -1,7 +1,7 @@ #include "../../../include/xtd/forms/control_paint.h" #include "../../../include/xtd/forms/control.h" #include "../../../include/xtd/forms/screen.h" -#include +#include #include #include @@ -294,8 +294,9 @@ void control_paint::draw_border_from_back_color(const forms::control& control, d draw_border(control, graphics, border, sides, light(back_color, percent_of_color), rect, back_color.is_dark()); } -void control_paint::draw_image(xtd::drawing::graphics& graphics, const xtd::drawing::image& image, const xtd::drawing::rectangle& rectangle, xtd::forms::image_layout image_layout) {draw_image(graphics, image, rectangle.x(), rectangle.y(), rectangle.width(), rectangle.height(), image_layout);} - +void control_paint::draw_image(xtd::drawing::graphics& graphics, const xtd::drawing::image& image, const xtd::drawing::rectangle& rectangle, xtd::forms::image_layout image_layout) { + draw_image(graphics, image, rectangle.x(), rectangle.y(), rectangle.width(), rectangle.height(), image_layout); +} void control_paint::draw_image(xtd::drawing::graphics& graphics, const xtd::drawing::image& image, int32 x, int32 y, int32 width, int32 height, xtd::forms::image_layout image_layout) { if (image_layout == xtd::forms::image_layout::none) diff --git a/src/xtd.forms/src/xtd/forms/picture_box.cpp b/src/xtd.forms/src/xtd/forms/picture_box.cpp index a2eae513f408..84ba9d9442e2 100644 --- a/src/xtd.forms/src/xtd/forms/picture_box.cpp +++ b/src/xtd.forms/src/xtd/forms/picture_box.cpp @@ -266,9 +266,7 @@ void picture_box::on_handle_created(const event_args& e) { void picture_box::on_paint(paint_event_args& e) { control::on_paint(e); - if (control_appearance() == forms::control_appearance::standard) { - if (image().has_value()) - control_paint::draw_image(e.graphics(), image().value(), e.clip_rectangle(), to_image_layout(size_mode())); - control_paint::draw_border_from_back_color(*this, e.graphics(), border_style(), border_sides(), back_color(), e.clip_rectangle()); - } + if (control_appearance() != forms::control_appearance::standard) return; + if (image().has_value()) control_paint::draw_image(e.graphics(), image().value(), e.clip_rectangle(), to_image_layout(size_mode())); + control_paint::draw_border_from_back_color(*this, e.graphics(), border_style(), border_sides(), back_color(), e.clip_rectangle()); }