ZKX's LAB

想学习用C语言写图形界面 c 写图形界面

2020-10-16知识15

想学习用C语言写图形界面 现在学习C语言,学的是C语言思想、方法和风格,都是在为学习其他语言打基础。所以在相关书中关于图形方式的描述很少见了,就是文本方式也没有了。若你真的想用图像方式,只有找上世纪90年代初的书籍如:1991年,TurboC程序设计及应用。西安电子科技大学,何振邦编著。1992年希望出版社出版的,C语言。要是在windows下作界面,学好VC+就可以了,利用程序框架和资源。

C语言中如何编写图形界面 最关键是要头文件\"graphics.hinclude<;graphics.h>;/*打印一个SINX曲线*/includevoid main(){int driver,mode,x,y1,y2,i,j,n;driver=DETECT;mode=0;initgraph(&driver,&mode,\"\");初使化必须有*/setcolor(RED);for(x=-300;x;x+){if(x%2=0){ i=x;y1=(int)80*sin(0.05*x)+100;putpixel(i,y1,YELLOW);}else{j=x;y2=(int)80*sin(0.05*x)+100;putpixel(j,y2,RED);lineto(i,y1);}}line(0,100,1000,100);line(0,0,0,1000);getch();closegraph();关闭*/}

关于C语言怎么写图形界面 case WM_PAINT:hdc=BeginPaint(hWnd,&ps);RECT rt;GetClientRect(hWnd,&rt);GDI绘图函数EndPaint(hWnd,&ps);break;

请问如何用c语言做一个图形界面呢?比如一个迷宫游戏的界面 图形界面接口因系统(windows/Linux)而不一样。在windows下因为系统是用C开发的,标准API接口就是C接口,称好windows API这就是常说的API编程int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow){WNDCLASSEX wcex;wcex.cbSize=sizeof(WNDCLASSEX);wcex.style=CS_HREDRAW|CS_VREDRAW;wcex.lpfnWndProc=WndProc;wcex.cbClsExtra=0;wcex.cbWndExtra=0;wcex.hInstance=hInstance;wcex.hIcon=LoadIcon(hInstance,MAKEINTRESOURCE(IDI_APPLICATION));wcex.hCursor=LoadCursor(NULL,IDC_ARROW);wcex.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);wcex.lpszMenuName=NULL;wcex.lpszClassName=szWindowClass;wcex.hIconSm=LoadIcon(wcex.hInstance,MAKEINTRESOURCE(IDI_APPLICATION));if。RegisterClassEx(&wcex)){MessageBox(NULL,T(\"Call to RegisterClassEx failed。T(\"Win32 Guided Tour\"),NULL);return 1;}hInst=hInstance;Store instance handle in our global variableThe parameters to CreateWindow explained:szWindowClass:the name of the applicationszTitle:the text that appears in the title bar。

#c语言程序设计#图形界面#c语言

随机阅读

qrcode
访问手机版