#include <xtd/xtd>
namespace screenshot_example {
class form1 :
public form {
public:
form1() {
client_size({380, 320});
screenshot_delay_label.auto_size(true);
hide_this_window_check_box.auto_size(true);
screenshot_button.click += {*this, &form1::on_screenshot_button_click};
save_screenshot_button.click += {*this, &form1::on_save_screenshot_button_click};
quit_button.click += {*this, &form1::close};
take_screen_shot_timer.tick += {*this, &form1::on_take_screen_shot_timer_tick};
take_new_screenshot();
}
private:
auto on_save_screenshot_button_click() -> void {
if (!screenshot_picture_box.image().has_value()) return;
dialog.
filter(
"PNG image(*.png)|*.png");
dialog.file_name("untitled");
if (dialog.show_sheet_dialog(*
this) ==
dialog_result::ok) screenshot_picture_box.image().value().save(dialog.file_name());
}
auto on_screenshot_button_click() -> void {
screenshot_button.enabled(false);
if (hide_this_window_check_box.checked())
hide();
take_screen_shot_timer.enabled(true);
}
auto on_take_screen_shot_timer_tick() -> void {
take_screen_shot_timer.enabled(false);
take_new_screenshot();
if (hide_this_window_check_box.checked()) show();
screenshot_button.enabled(true);
}
auto take_new_screenshot() -> void {
screenshot_picture_box.image(screenshot_bitmap);
}
label screenshot_delay_label =
label::create(options_group_box,
"Screenshot Delay (sec.) :", {15, 18});
};
}
auto main() -> int {
}
Encapsulates a GDI+ bitmap, which consists of the pixel data for a graphics image and its attributes....
Definition bitmap.hpp:26
void copy_from_screen(const xtd::drawing::point &upper_left_source, const xtd::drawing::point &upper_left_destination, const xtd::drawing::size &block_region_size)
Performs a bit-block transfer of color data, corresponding to a rectangle of pixels,...
graphics create_graphics()
Creates the xtd::drawing::graphics for the image.
@ my_pictures
The My Pictures folder.
Definition environment.hpp:209
static xtd::string get_folder_path(environment::special_folder folder)
Gets the path to the system special folder that is identified by the specified enumeration.
Definition environment.hpp:613
static time_span from_seconds(double value)
Returns a xtd::time_spam that represents a specified number of seconds, where the specification is ac...
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
Contains classes that represent ASCII and Unicode character encodings; abstract base classes for conv...
Definition basic_string_builder.hpp:16
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition point.hpp:54