
C_Kurs_Lekt / C_III_семестр / 16-3_Горизонтальное-вертикальное_меню_ск
.pdf
Горизонтальное-вертикальное меню
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<bios.h>
#include<ctype.h>
#include<string.h>
void draw_border(int , int ); void draw_border_2(int , int , int , int ); void display_menu(char *[], int , int ,int ); void display_menu_2(char *[], int , int ,int ); void put_color_text(int ,int ,char *, int ); int user_case(int x, int y, int count, char *menu[], char *keys); int user_case_2(int x, int y, int count, char *menu[], char *keys);
int popup( char *[],char *, int , int, int, int); int popup_2( char *[],char *, int , int, int, int); int is_in(char *s, char c);
void clskbr(void);
void main(){
int vibor, i,j,c, col; char *menu_name[] = {
|
|
|
" База данных ", |
|
|||||
|
|
|
" Задачи ", |
|
|||||
|
|
|
" Выход " |
|
|||||
|
|
|
|
}; |
|
|
|
|
|
char *menu_name_2[]={ |
|
|
|||||||
|
|
|
" От8рыть ", |
|
|||||
|
|
|
" Реда8тировать ", |
|
|||||
|
|
|
" Сохранить ", |
|
|||||
|
|
|
|
}; |
|
|
|
|
|
char *menu_name_3[]={ |
|
||||||||
|
|
|
" Найти ", |
|
|||||
|
|
|
" Удалить ", |
|
}; while(1)
{
clrscr();
textcolor(8);
cprintf("\r\n╔═════════════════╦╦╦╦╦╦╦╦╦╦═╦╦╦═╦═╦╦╦╦═╦═╦
╦╦╦╦╦╦═╦╦═╦╦═╦╦╦╦╦═════════════════╗\r\n");cprintf("║
");textcolor(7);cprintf("Laboratory job 7 part 1 variant 23 by EdRed");textcolor(8);cprintf("║\r\n");
cprintf("╚═════════════════╩╩╩╩╩╩╩╩╩╩═╩╩╩═╩═╩╩╩╩═╩═╩╩╩╩
╩╩╩═╩╩═╩╩═╩╩╩╩╩═════════════════╝\r\n");
_setcursortype(_NOCURSOR);
vibor=popup( menu_name, "012", 3, 2, 5, 1);

if(vibor==0)
{ popup_2(menu_name_2, "012", 3, 2, 8, 1);}
if(vibor==1)
{ popup_2(menu_name_3, "01", 2, 27, 8, 1);}
if(vibor==2) exit(1);
}
_setcursortype(_NORMALCURSOR); while(!kbhit());
}
/* Высвечиваем Yлавное меню в [8азаном месте */ void display_menu(char *menu[], int x, int y, int count) {
int i;
textcolor(14);
for(i=0;i<count;i++)
{
gotoxy(x,y);
cputs(menu[i]);
x+=25;
}
}
/* Выпадающее меню в [8азаном месте */ void display_menu_2(char *menu[], int x, int y, int count) {
int i;x++;
textcolor(14);
for(i=0;i<count;i++,y++)
{
gotoxy(x,y);
cputs(menu[i]);
}
}
// Ф[н8ция обводит рам8ой прямо[YоYольн[ю область void draw_border_2(int x1, int y1, int x2, int y2) {
int i;x1++;
textcolor(1);
for(i=x1+1;i<x2+10;i++)
{
gotoxy(i,y2); putch(196);
}
for(i=y1+1;i<y2;i++)
{
gotoxy(x1,i); putch(179);
gotoxy(x2+10,i); putch(179);
}
gotoxy(x1,y1); putch(218);
gotoxy(x1,y2); putch(192);
gotoxy(x2+10,y1); putch(191);