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; +} +