欧美一区二区三区,国内熟女精品熟女A片视频小说,日本av网,小鲜肉男男GAY做受XXX网站

c語言如何編寫界面程序

榮姿康2年前14瀏覽0評論

c語言如何編寫界面程序?

用C語言編寫界面程序要用到以下幾種東西

1. C語言的編輯器,例如Microsoft visual C++ 6.0

2. UCGUI源碼,包含各種窗體以及控件,直接在主函數調用就好了

下面進行代碼的編寫

1. 引用系統圖形庫函數

#include<windows.h>

#include "io.h"

#include "wingdi.h"

復制以下代碼到你的主函數中

#define LCD_XSIZE 800

#define LCD_YSIZE 480

#define LENGTHOF(A) (sizeof(A)/sizeof(A[0]))#define FRAME_SIZE LCD_XSIZE*LCD_YSIZE

uint16_t LCD_Frame[FRAME_SIZE];

HDC hDC;// 獲取控制臺窗口句柄

HWND GetConsoleHwnd(void)

{

#define MY_BUFSIZE 1024 // Buffer size for console window titles.

HWND hwndFound;// This is what is returned to the caller.

char pszNewWindowTitle[MY_BUFSIZE];

// Contains fabricated

char pszOldWindowTitle[MY_BUFSIZE];

// Contains original GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE); wsprintf(pszNewWindowTitle,"%d/%d", GetTickCount(), GetCurrentProcessId()); SetConsoleTitle(pszNewWindowTitle); Sleep(40); hwndFound=FindWindow(NULL, pszNewWindowTitle); SetConsoleTitle(pszOldWindowTitle); return(hwndFound);

}

BITMAPINFOHEADER bmiHeader;

void LCD_Init(){

bmiHeader.biSize =sizeof(BITMAPINFOHEADER); bmiHeader.biWidth = LCD_XSIZE; bmiHeader.biHeight = -LCD_YSIZE; bmiHeader.biPlanes = 1; bmiHeader.biBitCount = 16; bmiHeader.biCompression = BI_RGB; bmiHeader.biSizeImage = 0; bmiHeader.biXPelsPerMeter = 0; bmiHeader.biYPelsPerMeter = 0; bmiHeader.biClrUsed = 0; bmiHeader.biClrImportant = 0; SetDIBitsToDevice (hDC, // hDC 0,0,LCD_XSIZE,LCD_YSIZE, 0,0,0,LCD_YSIZE, LCD_Frame,&bmiHeader,DIB_RGB_COLORS );// wUsage*/}

void LCD_Repain(){/*StretchDIBits(bufferHDC, 0,0,0-m_nVideoW,0-m_nVideoH, 0,0,m_nVideoW, m_nVideoH, szFrame,&BmpInfo,DIB_RGB_COLORS,SRCCOPY); */ StretchDIBits(hDC, 0,0,LCD_XSIZE,LCD_YSIZE, 0,0,LCD_XSIZE,LCD_YSIZE, LCD_Frame,&bmiHeader,DIB_RGB_COLORS,SRCCOPY );

}

2. 移植UCGUI代碼到你的工程里,主要是修改畫點函數:

#define FRAME_SIZE LCD_XSIZE*LCD_YSIZEextern uint16_t LCD_Frame[FRAME_SIZE];#define GETDATAPTR(xPhys,yPhys) (uint16_t*)((uint32_t)LCD_Frame + 2*(xPhys+yPhys*LCD_XSIZE))#define SETPIXEL _SetPixel#define XORPIXEL _XorPixel //{*(uint16_t)GETDATAPTR(xPhys,yPhys) = 0XFFFF - *(uint16_t*)GETDATAPTR(xPhys,yPhys);} //extern uint16_t *pFrameBuffer; static void _SetPixel(int x, int y, uint16_t Pixel){ *(uint16_t*)GETDATAPTR(x,y) = Pixel;// printf("_SetPixel\r\n");} uint16_t _GetPixel(int x, int y) {uint16_t Pixel; Pixel = *GETDATAPTR(x,y);

return Pixel;

}

3. 在主函數中調用初始化,在循環中調用刷新函數

4. 執行函數后,會在控制臺顯示你定義的窗口畫面

xor函數 java,c語言如何編寫界面程序