Как изменить стиль курсора с помощью C
Опубликовано: 4 Марта, 2022
В этой статье мы обсудим, как изменить стиль курсора на экране в C.
Подход: идея состоит в том, чтобы использовать функцию setcursortype () для изменения стиля курсора на экране вывода. Эта функция принимает в качестве аргумента тип курсора и объявляется в заголовочном файле conio.h.
Заголовочный файл:
#include <conio.h>
Ниже приведен список допустимых типов курсора:
- _NOCURSOR : выключает курсор.
- _NORMALCURSOR : нормальный курсор подчеркивания.
- _SOLIDCURSOR : курсор в виде сплошного блока.
Синтаксис:
void _setcursortype(int cursor-type)
Программа 1:
Below is the program for changing the cursor type to _NOCURSOR:
C
// C program to change cursor style #include <conio.h> #include <stdio.h> // Driver Code int main() { // Call _setcursortype function _setcursortype(_NOCURSOR); // Print message cprintf( "No Cursor :" ); return 0; } |
Output:
Below is the output of the above program:
Программа 2:
Below is the program for changing the cursor type to _SOLIDCURSOR:
C
// C program to change cursor style #include <conio.h> #include <stdio.h> // Driver Code int main() { // Call _setcursortype function _setcursortype(_SOLIDCURSOR); // Print message cprintf( "Solid Cursor :" ); return 0; } |
Output:
Below is the output of the above program:
Программа 3:
Below is the program for changing the cursor type to _NORMALCURSOR:
C
// C program to change cursor style #include <conio.h> #include <stdio.h> // Driver Code int main() { // Call _setcursortype function _setcursortype(_NORMALCURSOR); // Print message cprintf( "Normal Cursor :" ); return 0; } |
Output:
Below is the output of the above program:
Хотите узнать о лучших видео и практических задачах, ознакомьтесь с Базовым курсом C для базового и продвинутого C.