From 00a0f92ff3459d7704e231e5993054cc45951695 Mon Sep 17 00:00:00 2001 From: lsy2246 Date: Fri, 29 Dec 2023 00:20:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E5=A5=BD=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E5=B9=B6=E7=82=B9=E5=87=BB=E9=9A=90=E8=97=8FASCLL=E7=A0=81?= =?UTF-8?q?=E5=92=8C=E5=AF=B9=E8=AF=9D=E6=A1=86=E3=80=81=E9=A2=9C=E8=89=B2?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../effect_keystroke.h | 15 ++++++ .../effect_windows_api.c | 25 +++++++++ .../founction_statement_page.h | 5 ++ .../function_statement_effect.h | 12 +++++ .../idea/Student _Manage _System/main.c | 52 +++++++++++++++++++ 5 files changed, 109 insertions(+) create mode 100644 practice_code/idea/Student _Manage _System/effect_keystroke.h create mode 100644 practice_code/idea/Student _Manage _System/effect_windows_api.c create mode 100644 practice_code/idea/Student _Manage _System/founction_statement_page.h create mode 100644 practice_code/idea/Student _Manage _System/function_statement_effect.h create mode 100644 practice_code/idea/Student _Manage _System/main.c diff --git a/practice_code/idea/Student _Manage _System/effect_keystroke.h b/practice_code/idea/Student _Manage _System/effect_keystroke.h new file mode 100644 index 0000000..47b9c5b --- /dev/null +++ b/practice_code/idea/Student _Manage _System/effect_keystroke.h @@ -0,0 +1,15 @@ +#ifndef EFFECT_KEYSTROKE_H //检查宏有没有被定义过 +#define EFFECT_KEYSTROKE_H //定义宏 +//按键ascll码定义 +#define UP 72 // 方向键:上 +#define DOWN 80 // 方向键:下 +#define LEFT 75 // 方向键:左 +#define RIGHT 77 // 方向键:右 +#define CTRL_A 1 // 功能键: Ctrl+A +#define CTRL_D 4 // 功能键: Ctrl+D +#define CTRL_S 19 // 功能键: Ctrl+S +#define CTRL_F 6 // 功能键: Ctrl+F +#define ESC 27 // 功能键: ESC +#define TAB 9 // 功能键: TAB +#define ENTER 13 //功能键: Enter +#endif //EFFECT_KEYSTROKE_H \ No newline at end of file diff --git a/practice_code/idea/Student _Manage _System/effect_windows_api.c b/practice_code/idea/Student _Manage _System/effect_windows_api.c new file mode 100644 index 0000000..e1bfc8a --- /dev/null +++ b/practice_code/idea/Student _Manage _System/effect_windows_api.c @@ -0,0 +1,25 @@ +#include + +void HideCursor ()//隐藏光标 +{ + CONSOLE_CURSOR_INFO curInfo; //定义光标信息的结构体变量 + curInfo . dwSize = 1; //如果没赋值的话,光标隐藏无效 + curInfo . bVisible = FALSE; //将光标设置为不可见 + HANDLE handle = GetStdHandle ( STD_OUTPUT_HANDLE ); //获取控制台句柄 + SetConsoleCursorInfo ( handle , & curInfo ); //设置光标信息 +} + +void CursorJump ( int y , int x )//光标跳转 +{ + COORD pos; //定义光标位置的结构体变量 + pos . X = x; //横坐标 + pos . Y = y; //纵坐标 + HANDLE handle = GetStdHandle ( STD_OUTPUT_HANDLE ); //获取控制台句柄 + SetConsoleCursorPosition ( handle , pos ); //设置光标位置 +} + +void color ( int c )//颜色设置 +{ + SetConsoleTextAttribute ( GetStdHandle ( STD_OUTPUT_HANDLE ) , c ); //颜色设置 + //注:SetConsoleTextAttribute是一个API(应用程序编程接口) +} diff --git a/practice_code/idea/Student _Manage _System/founction_statement_page.h b/practice_code/idea/Student _Manage _System/founction_statement_page.h new file mode 100644 index 0000000..54d2cfd --- /dev/null +++ b/practice_code/idea/Student _Manage _System/founction_statement_page.h @@ -0,0 +1,5 @@ +#ifndef FUNCTION_STATEMENT_PAGE_H //检查宏有没有被定义过 +#define FUNCTION_STATEMENT_PAGE_H //定义宏 + + +#endif //FUNCTION_STATEMENT_PAGE_H \ No newline at end of file diff --git a/practice_code/idea/Student _Manage _System/function_statement_effect.h b/practice_code/idea/Student _Manage _System/function_statement_effect.h new file mode 100644 index 0000000..2701c56 --- /dev/null +++ b/practice_code/idea/Student _Manage _System/function_statement_effect.h @@ -0,0 +1,12 @@ +#ifndef FUNCTION_STATEMENT_EFFECT_H //检查函数有没有被声明 +#define FUNCTION_STATEMENT_EFFECT_H //定义宏 + +#include "effect_keystroke.h"//包含按键头文件 + +void HideCursor ();//隐藏光标 + +void CursorJump ( int y , int x );//光标跳转 + +void color ( int c );//颜色设置 + +#endif //FUNCTION_STATEMENT_EFFECT_H \ No newline at end of file diff --git a/practice_code/idea/Student _Manage _System/main.c b/practice_code/idea/Student _Manage _System/main.c new file mode 100644 index 0000000..afa5626 --- /dev/null +++ b/practice_code/idea/Student _Manage _System/main.c @@ -0,0 +1,52 @@ +//头文件 +#include +#include +#include + +//自定义头文件 +#include "founction_statement_page.h"//界面 +#include "function_statement_effect.h"//功能 + +//主函数 +int main ( void ) +{ + //定义变量 + char start_pick='0';//开始的选择 + + while(1) + { + //打印菜单 + HideCursor ();//隐藏光标 + system ( "cls" );//清屏 + printf ( "\n\n\n\n\n\n\n\n" ); + color(2);//设置颜色 + printf ("\t\t\t\t\t\t————欢迎使用学生管理系统————\n"); + color(1);//设置颜色 + printf ("\t\t\t\t\t\t[Enter]"); + color(7);//设置颜色 + printf (" 进入程序\n"); + color(1);//设置颜色 + printf ( "\t\t\t\t\t\t[ESC]" ); + color(7);//设置颜色 + printf (" 退出程序\n"); + color(4);//设置颜色 + printf ("\t\t\t\t\t\t按下相应按键进入对应模式\n"); + //获取用户的输入 + start_pick=(char)_getch(); + //判断用户输入 + switch(start_pick) + { + case ENTER: + { + + break; + } + case ESC: + { + return 0; + } + } + } + return 0; +} +