新建好菜单并点击隐藏ASCLL码和对话框、颜色设置
This commit is contained in:
parent
a603cadf28
commit
00a0f92ff3
@ -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
|
@ -0,0 +1,25 @@
|
||||
#include <windows.h>
|
||||
|
||||
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(应用程序编程接口)
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
#ifndef FUNCTION_STATEMENT_PAGE_H //检查宏有没有被定义过
|
||||
#define FUNCTION_STATEMENT_PAGE_H //定义宏
|
||||
|
||||
|
||||
#endif //FUNCTION_STATEMENT_PAGE_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
|
52
practice_code/idea/Student _Manage _System/main.c
Normal file
52
practice_code/idea/Student _Manage _System/main.c
Normal file
@ -0,0 +1,52 @@
|
||||
//头文件
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <conio.h>
|
||||
|
||||
//自定义头文件
|
||||
#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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user