xtd 0.2.0
picture_box.h
Go to the documentation of this file.
1 #pragma once
5 #include "border_sides.h"
6 #include "border_style.h"
7 #include "control.h"
9 #include <xtd/drawing/image>
10 #include <xtd/optional>
11 
13 namespace xtd {
15  namespace forms {
32  class forms_export_ picture_box : public control {
33  struct data;
34 
35  public:
37 
39  picture_box();
41 
43 
47  virtual forms::border_sides border_sides() const noexcept;
51 
55  virtual forms::border_style border_style() const noexcept;
61 
65  std::optional<drawing::image> image() const noexcept;
70  picture_box& image(const drawing::image& image);
75  picture_box& image(std::nullptr_t);
76 
80  picture_box_size_mode size_mode() const noexcept;
85  picture_box& size_mode(picture_box_size_mode size_mode);
87 
89 
91  using control::create;
98  static picture_box create(const xtd::drawing::image& image, const drawing::point& location = {-1, -1}, const drawing::size& size = {-1, -1}, const xtd::ustring& name = xtd::ustring::empty_string);
106  static picture_box create(const control& parent, const xtd::drawing::image& image, const drawing::point& location = {-1, -1}, const drawing::size& size = {-1, -1}, const xtd::ustring& name = xtd::ustring::empty_string);
108 
109  protected:
111 
113  forms::create_params create_params() const noexcept override;
115 
116  protected:
118 
122  void on_handle_created(const event_args& e) override;
123  void on_paint(paint_event_args& e) override;
124 
125  drawing::size measure_control() const noexcept override;
127 
128  private:
129  std::shared_ptr<data> data_;
130  };
131  }
132 }
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition: point.h:54
Stores an ordered pair of integers, which specify a height and width.
Definition: size.h:31
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Encapsulates the information needed when creating a control.
Definition: create_params.h:27
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:46
static control create(const drawing::point &location={-1, -1}, const drawing::size &size={-1, -1}, const xtd::ustring &name=xtd::ustring::empty_string)
A factory to create a specified control with specified location, size, and name.
Provides data for the xtd::forms::control::paint event.
Definition: paint_event_args.h:28
Represents a standard Windows picture box.
Definition: picture_box.h:32
border_sides
Specifies how a control anchors to the edges of its container.
Definition: border_sides.h:21
border_style
Specifies the border style for a control.
Definition: border_style.h:20
An abstract base class that provides functionality for the bitmap and metafile descended classes...
Definition: image.h:48
Contains xtd::forms::border_sides enum class.
Defines the base class for controls, which are components with visual representation.
Definition: control.h:78
picture_box_size_mode
Specifies how an image is positioned within a picture_box.
Definition: picture_box_size_mode.h:20
Contains xtd::forms::control control.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
static const ustring empty_string
Represents the empty string.
Definition: ustring.h:53
Contains xtd::forms::picture_box_size_mode enum class.
Specifies that both the x and y coordinates of the control are defined.
Contains xtd::forms::border_style enum class.
size_t size
Represents a size of any object in bytes.
Definition: types.h:195