xtd 0.2.0
Loading...
Searching...
No Matches

◆ cursor_size() [2/2]

static void xtd::console::cursor_size ( int32  size)
static

Sets the height of the cursor within a character cell.

Parameters
sizeThe size of the cursor expressed as a percentage of the height of a character cell. The property value ranges from 1 to 100.
Exceptions
xtd::argument_out_of_range_exceptionThe value specified in a set operation is less than 1 or greater than 100.
Examples
This example demonstrates the cursor_size property. The example increases the size of the cursor each time any console key is pressed, then restores the cursor to its original size before terminating.
#include <xtd/console>
using namespace xtd;
auto main() -> int {
auto m0 = "This example increments the cursor size from 1% to 100%:\n";
auto m1 = "Cursor size = {0}%. (Press any key to continue...)";
auto sizes = { 1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };
auto save_cursor_size = console::cursor_size();
for (auto size : sizes) {
}
console::cursor_size(save_cursor_size);
}
// This code produces the following output :
//
// This example increments the cursor size from 1% to 100%:
//
// Cursor size = 1%. (Press any key to continue...)
// Cursor size = 10%. (Press any key to continue...)
// Cursor size = 20%. (Press any key to continue...)
// Cursor size = 30%. (Press any key to continue...)
// Cursor size = 40%. (Press any key to continue...)
// Cursor size = 50%. (Press any key to continue...)
// Cursor size = 60%. (Press any key to continue...)
// Cursor size = 70%. (Press any key to continue...)
// Cursor size = 80%. (Press any key to continue...)
// Cursor size = 90%. (Press any key to continue...)
// Cursor size = 100%. (Press any key to continue...)
static int32 cursor_size()
Gets or sets the height of the cursor within a character cell.
static console_key_info read_key()
Obtains the next character or function key pressed by the user. The pressed key is displayed in the c...
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
size_t size
Represents a size of any object in bytes.
Definition size.h:23
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10