44 if (!checked_back_color_.has_value() || checked_back_color_.value() != color) {
45 checked_back_color_ = color;
52 if (checked_back_color_.has_value()) {
53 checked_back_color_.reset();
66 if (!slider_color_.has_value() || slider_color_.value() != color) {
67 slider_color_ = color;
74 if (slider_color_.has_value()) {
75 slider_color_.reset();
84 virtual bool rounded()
const {
return rounded_;}
89 if (rounded_ != value) {
98 virtual bool checked()
const {
return checked_;}
118 if (show_text_ != value) {
164 float height =
static_cast<float>(
e.clip_rectangle().height() -
e.clip_rectangle().height() % 2);
165 float offset = (
e.clip_rectangle().width() -
height) / 2.0f - 0.5f;
172 e.graphics().fill_pie(
drawing::solid_brush(button_back_color),
e.clip_rectangle().width() -
height - offset / 2.0f - 0.5f, .0f,
static_cast<float>(
height),
static_cast<float>(
height), 270.0f, 180.0f);
173 e.graphics().fill_rectangle(
drawing::solid_brush(button_back_color),
height / 2.0f + offset / 2.0f, .0f,
static_cast<float>(
e.clip_rectangle().width() -
height) - offset,
static_cast<float>(
height));
177 drawing::size_f slider_size(
static_cast<float>((
e.clip_rectangle().width() - 6) / 2),
static_cast<float>(
e.clip_rectangle().height() - 6));
183 e.graphics().clear(button_back_color);
185 e.graphics().draw_line(
drawing::pen(
control_paint::dark(button_back_color), 2),
e.clip_rectangle().left(),
e.clip_rectangle().top(),
e.clip_rectangle().right(),
e.clip_rectangle().top());
186 e.graphics().draw_line(
drawing::pen(
control_paint::dark(button_back_color), 2),
e.clip_rectangle().left(),
e.clip_rectangle().top(),
e.clip_rectangle().left(),
e.clip_rectangle().bottom());
187 e.graphics().draw_line(
drawing::pen(
control_paint::light(button_back_color), 2),
e.clip_rectangle().left(),
e.clip_rectangle().bottom(),
e.clip_rectangle().right(),
e.clip_rectangle().bottom());
188 e.graphics().draw_line(
drawing::pen(
control_paint::light(button_back_color), 2),
e.clip_rectangle().right(),
e.clip_rectangle().top() + 2,
e.clip_rectangle().right(),
e.clip_rectangle().bottom());
200 std::optional<xtd::drawing::color> checked_back_color_;
201 std::optional<xtd::drawing::color> slider_color_;
202 bool rounded_ =
true;
203 bool auto_check_ =
true;
204 bool show_text_ =
false;
205 bool checked_ =
false;
Represents an ARGB (alpha, red, green, blue) color.
Definition: color.h:39
static color average(const color &color1, const color &color2, double weight, bool average_alpha)
Returns the weighted average color between the two given colors.
Definition: color.h:592
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition: pen.h:29
Represents an ordered pair of floating-point x- and y-coordinates that defines a point in a two-dimen...
Definition: point_f.h:26
Stores an ordered pair of floating-point, which specify a height and width.
Definition: size_f.h:24
float width() const
Gets the horizontal component of this Size class.
Definition: size_f.h:65
float height() const
Gets he vertical component of this Size Class.
Definition: size_f.h:55
Defines a xtd::drawing::brush of a single color. Brushes are used to fill graphics shapes,...
Definition: solid_brush.h:22
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
static const event_args empty
Provides a value to use with events that do not have event data.
Definition: event_args.h:31
Represents an event.
Definition: event.h:21
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
Contains xtd::forms::control_paint class.
virtual void on_handle_created(const event_args &e)
Raises the control::handle_created event.
virtual void on_paint(paint_event_args &e)
Raises the control::paint event.
event< switch_button, event_handler > checked_changed
Occurs when the value of the checked property changes.
Definition: switch_button.h:127
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17