Skip to content

Commit

Permalink
Review code
Browse files Browse the repository at this point in the history
  • Loading branch information
gammasoft71 committed May 13, 2024
1 parent 5d014cb commit 1698a13
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/xtd.forms/src/xtd/forms/control_paint.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "../../../include/xtd/forms/control_paint.h"
#include "../../../include/xtd/forms/control.h"
#include "../../../include/xtd/forms/screen.h"
#include <xtd/drawing/color_converter.h>
#include <xtd/drawing/color_converter>
#include <xtd/as>
#include <xtd/math>

Expand Down Expand Up @@ -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)
Expand Down
8 changes: 3 additions & 5 deletions src/xtd.forms/src/xtd/forms/picture_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

0 comments on commit 1698a13

Please sign in to comment.