xtd 0.2.0
Loading...
Searching...
No Matches
move_form.cpp

demonstrates the use of form event.

Windows

macOS

Gnome

#include <xtd/xtd>
auto main() -> int {
auto main_form = form::create("Move form");
auto mouse_location = point::empty;
main_form.mouse_down += delegate_(object & sender, const mouse_event_args & e) {
mouse_location = e.location();
main_form.cursor(cursors::no_move_2d());
};
main_form.mouse_up += delegate_(object & sender, const mouse_event_args & e) {
mouse_location = point::empty;
main_form.cursor(cursors::default_cursor());
};
main_form.mouse_move += delegate_(object & sender, const mouse_event_args & e) {
if (mouse_location != point::empty) main_form.location(main_form.location() + e.location() - mouse_location);
};
application::run(main_form);
}
#define delegate_
The declaration of a delegate type is similar to a method signature. It has a return value and any nu...
Definition delegate.hpp:900