設(shè)計(jì)彩色框的C源程序
更新時(shí)間: 2007-06-01 10:00:14來源: 粵嵌教育瀏覽量:754
/*
*
* Short driver module
*
*/
main()
{
clrscr();
box(1,1,23,79);
box(2,2,21,77);
box(3,3,19,75);
box(4,4,17,73);
box(5,5,15,71);
box(6,6,13,69);
box(7,7,11,67);
box(8,8,9,65);
box(9,9,7,63);
box(10,10,5,61);
box(11,11,3,59);
box(12,12,1,57);
poscur(24,1);
}
/************************************************************
* BOX *
*----------------------------------------------------------*
* Written by: Jeff Ebert 7/01/87 *
* Modified by: xxxxxxxxxx *
* *
* Please modify me! *
* Possible Enhancements include but are not limited to: *
* 1) Variable box character styles [1 line or 2] *
* 2) Error checking *
* 3) Color options *
* *
* *
* This function builds a simple double frame for a menu. *
* The function is passed the parameters for the upper *
* left corner row, upper left corner column the height *
* of the frame and the width. *
* *
************************************************************/
#include
#define ULCOR 201
#define URCOR 187
#define LLCOR 200
#define LRCOR 188
#define VBAR 186
#define HBAR 205
#define ESC 27
box(row, col, hgt, wdth)
int row, col, hgt, wdth;
{
int x, y;
poscur(row,col);
putchar(ULCOR);
for(x = col + 1; x <=(col + wdth -1); x++)
putchar(HBAR);
putchar(URCOR);
for(x = row + 1; x <=(row + hgt - 1); x++){
poscur(x,col);
putchar(VBAR);
poscur(x,col+wdth);
putchar(VBAR);
}
poscur(x,col);
putchar(LLCOR);
for(x= col + 1; x <=(col + wdth -1); x++)
putchar(HBAR);
putchar(LRCOR);
}
/********************************************************
* POSCUR *
*------------------------------------------------------*
* This function positions the cursor at the specified *
* x,y coordinate. It uses the ANSI standard ESCAPE *
* sequence to produce the desired effect. Its not the *
* fastest way to position the cursor, but perhaps the *
* most portable. *
* *
********************************************************/
poscur(xcor,ycor)
int xcor,ycor;
{
printf("%c[%d;%dH",ESC,xcor,ycor);
}
/********************************************************
* CLRSCR *
*------------------------------------------------------*
* This function positions the cursor at the specified *
* x,y coordinate. It uses the ANSI standard ESCAPE *
* sequence to produce the desired effect. Its not the *
* fastest way to position the cursor, but perhaps the *
* most portable. *
* *
********************************************************/
clrscr()
{
printf("%c[2J",ESC);
}
粵嵌動態(tài)
推薦閱讀
- ·Linux字符設(shè)備驅(qū)動框架解析:file_operations的核心作用與實(shí)現(xiàn)
- ·廣東朝歌數(shù)碼科技股份有限公司專場招聘會
- ·深化產(chǎn)教融合,共筑技能人才培養(yǎng)新生態(tài) —— 廣州華立學(xué)院到訪粵嵌從化校區(qū)為深化產(chǎn)教
- ·校企合作新突破 | 粵嵌科技與三亞學(xué)院共探產(chǎn)教融合新路徑
- ·粵嵌科技入選國家級職業(yè)數(shù)字展館聯(lián)合建設(shè)單位,賦能計(jì)算機(jī)程序設(shè)計(jì)員高技能人才培養(yǎng)
- ·嵌入式實(shí)時(shí)操作系統(tǒng)的性能優(yōu)化與實(shí)現(xiàn)路徑
- ·校企攜手賦能教育!粵嵌科技助力海南科技職業(yè)大學(xué)探索 AGI 時(shí)代教學(xué)新范式
- ·嵌入式系統(tǒng)中的低功耗設(shè)計(jì)策略與實(shí)現(xiàn)路徑
- ·深圳市軒宇軟件開發(fā)有限公司專場招聘會
- ·嵌入式系統(tǒng)中的代碼空間優(yōu)化:策略與實(shí)踐