xtd - Reference Guide  0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
picture_box.h
Go to the documentation of this file.
1 #pragma once
5 #include <optional>
6 #include "control.h"
7 #include "border_style.h"
9 #include <xtd/drawing/image.h>
10 
12 namespace xtd {
14  namespace forms {
25  public:
26  picture_box();
27 
31  virtual forms::border_style border_style() const {return border_style_;}
37 
38  drawing::size default_size() const override {return {100, 50};}
39 
43  const std::optional<drawing::image> image() const {return image_;}
53  picture_box& image(std::nullptr_t);
54 
58  picture_box_size_mode size_mode() const {return size_mode_;}
64 
65  protected:
66  forms::create_params create_params() const override;
67 
70  void on_handle_created(const event_args& e) override;
71 
72  drawing::size measure_control() const override;
73 
76  std::optional<drawing::image> image_;
79  };
80  }
81 }
Contains xtd::forms::border_style enum class.
An abstract base class that provides functionality for the bitmap and metafile descended classes.
Definition: image.h:34
Stores an ordered pair of integers, which specify a height and width.
Definition: size.h:25
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
Defines the base class for controls, which are components with visual representation.
Definition: control.h:67
Represents a standard Windows picture box.
Definition: picture_box.h:24
picture_box & image(const drawing::image &image)
Sets the image that is displayed by picture_box.
virtual picture_box & border_style(forms::border_style border_style)
Sets the border style for the control.
picture_box_size_mode size_mode() const
Indicates how the image is displayed.
Definition: picture_box.h:58
picture_box & size_mode(picture_box_size_mode size_mode)
Indicates how the image is displayed.
virtual forms::border_style border_style() const
Gets the border style for the control.
Definition: picture_box.h:31
forms::create_params create_params() const override
Gets the required creation parameters when the control handle is created.
drawing::size measure_control() const override
Measure this control.
picture_box & image(std::nullptr_t)
Resets the image that is displayed by picture_box.
const std::optional< drawing::image > image() const
Gets the image that is displayed by picture_box.
Definition: picture_box.h:43
drawing::size default_size() const override
Gets the default size of the control.
Definition: picture_box.h:38
void on_handle_created(const event_args &e) override
Overrides the on_handle_created(const event_args&) method.
Contains xtd::forms::control control.
#define forms_export_
Define shared library export.
Definition: forms_export.h:13
picture_box_size_mode
Specifies how an image is positioned within a picture_box.
Definition: picture_box_size_mode.h:18
border_style
Specifies the border style for a control.
Definition: border_style.h:18
@ normal
The image is placed in the upper-left corner of the picture_box. The image is clipped if it is larger...
Contains xtd::drawing::image class.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
Contains xtd::forms::picture_box_size_mode enum class.