#include <cursor.h>
Represents the image used to paint the mouse pointer.
- Namespace
- xtd::forms
- Library
- xtd.forms
- See also
- xtd::forms::cursors
- Examples
- The following code example demonstrates the use of cursor component.
#include <xtd/xtd>
using namespace std;
class form1 :
public form {
public:
form1() {
client_size({360, 240});
list_box_cursors.parent(*this);
list_box_cursors.bounds({20, 20, 150, 200});
list_box_cursors.items().push_back_range({{
"Default",
cursors::default_cursor()}, {
"Application Starting",
cursors::app_starting()}, {
"Arrow",
cursors::arrow()}, {
"Closed hand",
cursors::closed_hand()}, {
"Contextual menu",
cursors::contextual_menu()}, {
"Cell",
cursors::cell()}, {
"Cross",
cursors::cross()}, {
"Disappearing item",
cursors::disappearing_item()}, {
"Drag copy",
cursors::drag_copy()}, {
"Drag link",
cursors::drag_link()}, {
"Hand",
cursors::hand()}, {
"Help",
cursors::help()}, {
"Horizontal split",
cursors::hsplit()}, {
"I beam",
cursors::ibeam()}, {
"No",
cursors::no()}, {
"No drag",
cursors::no_drag()}, {
"No move 2d",
cursors::no_move_2d()}, {
"No move horizontal",
cursors::no_move_horiz()}, {
"No move vertical",
cursors::no_move_vert()}, {
"Open hand",
cursors::open_hand()}, {
"Pan east",
cursors::pan_east()}, {
"Pan north east",
cursors::pan_ne()}, {
"Pan north",
cursors::pan_north()}, {
"Pan north west",
cursors::pan_nw()}, {
"Pan south east",
cursors::pan_se()}, {
"Pan south",
cursors::pan_south()}, {
"Pan south west",
cursors::pan_sw()}, {
"Pan West",
cursors::pan_west()}, {
"Size all",
cursors::size_all()}, {
"Size north-east south-west",
cursors::size_nesw()}, {
"Size north south",
cursors::size_ns()}, {
"Size north-west south-east",
cursors::size_nwse()}, {
"Size west east",
cursors::size_we()}, {
"Up arrow",
cursors::up_arrow()}, {
"Vertical I beam",
cursors::vibeam()}, {
"Vertical split",
cursors::vsplit()}, {
"Wait",
cursors::wait_cursor()}, {
"Zoom in",
cursors::zoom_in()}, {
"Zoom out",
cursors::zoom_out()}});
list_box_cursors.selected_index_changed += [&] {
test_zone.cursor(any_cast<forms::cursor>(list_box_cursors.selected_item().tag()));
};
list_box_cursors.selected_item("Default");
test_zone.parent(*this);
test_zone.bounds({190, 20, 150, 200});
}
private:
};
auto main()->int {
}
- Examples:
- circular_form.cpp.
|
intptr | handle () const noexcept |
| Gets the handle of the cursor. More...
|
|
drawing::point | hot_spot () const noexcept |
| Gets the cursor hot spot. More...
|
|
drawing::size | size () const noexcept |
| Gets the size of the cursor object. More...
|
|
std::any | tag () const noexcept |
| Gets the object that contains data about the control. More...
|
|
void | tag (std::any tag) |
| Sets the object that contains data about the control. More...
|
|
| object ()=default |
| Create a new instance of the ultimate base class object. More...
|
|
bool | equals (const object &obj) const noexcept |
| Determines whether the specified object is equal to the current object. More...
|
|
virtual size_t | get_hash_code () const noexcept |
| Serves as a hash function for a particular type. More...
|
|
template<typename object_t > |
std::unique_ptr< object_t > | memberwise_clone () const noexcept |
| Gets the type of the current instance. More...
|
|
virtual bool | equals (const cursor &) const noexcept=0 |
| Indicates whether the current object is equal to another object of the same type. More...
|
|
◆ cursor() [1/2]
xtd::forms::cursor::cursor |
( |
| ) |
|
Initializes a new instance of the cursor class.
◆ cursor() [2/2]
xtd::forms::cursor::cursor |
( |
intptr |
handle | ) |
|
|
explicit |
Initializes a new instance of the Cursor class from the specified Windows handle.
- Parameters
-
handle | An IntPtr that represents the Windows handle of the cursor to create. |
◆ copy_handle()
intptr xtd::forms::cursor::copy_handle |
( |
| ) |
const |
Copies the handle of this cursor.
- Returns
- An intptr that represents the cursor's handle.
◆ current() [1/2]
Gets a cursor object that represents the mouse cursor.
- Returns
- A cursor that represents the mouse cursor. The default is cursor::none.
◆ current() [2/2]
Sets a cursor object that represents the mouse cursor.
- Parameters
-
cursor | A cursor that represents the mouse cursor. The default is cursor::none. |
◆ from_bitmap() [1/2]
Create a cursor form a specified bitmap with specified hot spot.
- Parameters
-
- Returns
- A new cursor instance.
◆ from_bitmap() [2/2]
Create a cursor form a specified bitmap.
- Parameters
-
- Returns
- A new cursor instance.
◆ handle()
intptr xtd::forms::cursor::handle |
( |
| ) |
const |
|
noexcept |
Gets the handle of the cursor.
- Returns
- An intptr that represents the cursor's handle.
◆ hide()
static void xtd::forms::cursor::hide |
( |
| ) |
|
|
static |
Hides the cursor.
The show and hide method calls must be balanced. For every call to the hide method there must be a corresponding call to the show method.
◆ hot_spot()
Gets the cursor hot spot.
- Returns
- A point representing the cursor hot spot.
◆ position() [1/2]
Gets the cursor's position.
- Returns
- A point that represents the cursor's position in screen coordinates.
◆ position() [2/2]
static void xtd::forms::cursor::position |
( |
const drawing::point & |
position | ) |
|
|
static |
Sets the cursor's position.
- Parameters
-
position | A point that represents the cursor's position in screen coordinates. |
◆ show()
static void xtd::forms::cursor::show |
( |
| ) |
|
|
static |
Displays the cursor.
The show and hide method calls must be balanced. For every call to the hide method there must be a corresponding call to the show method.
◆ size()
Gets the size of the cursor object.
- Returns
- A size that represents the width and height of the cursor.
◆ tag() [1/2]
std::any xtd::forms::cursor::tag |
( |
| ) |
const |
|
noexcept |
Gets the object that contains data about the control.
- Returns
- A std::any that contains data about the control. The default is empty.
◆ tag() [2/2]
void xtd::forms::cursor::tag |
( |
std::any |
tag | ) |
|
Sets the object that contains data about the control.
- Parameters
-
tag | A std::any that contains data about the control. The default is empty. |
◆ to_string()
Returns a string containing the name of the cursor.
- Returns
- A string containing the name of the cursor.
Reimplemented from xtd::object.
◆ none
cursor xtd::forms::cursor::none |
|
static |
The documentation for this class was generated from the following file: