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

demonstrates the use of form event.

Windows

macOS

Gnome

#include <xtd/forms/application>
#include <xtd/forms/form>
using namespace xtd;
using namespace xtd::drawing;
using namespace xtd::forms;
auto main()->int {
auto main_form = form::create("Move form");
auto mouse_location = point::empty;
main_form.mouse_down += [&](object & sender, const mouse_event_args & e) {
mouse_location = e.location();
main_form.cursor(cursors::no_move_2d());
};
main_form.mouse_up += [&](object & sender, const mouse_event_args & e) {
mouse_location = point::empty;
main_form.cursor(cursors::default_cursor());
};
main_form.mouse_move += [&](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);
}
Provides data for the xtd::forms::control::mouse_up, xtd::forms::control::mouse_down,...
Definition mouse_event_args.h:32
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.h:11
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.h:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10