win32 各種形狀api

2021-08-22 08:53:50 字數 2665 閱讀 7249

1.rectangle //繪製矩形

bool rectangle(

int x1,

int y1,

int x2,

int y2

); bool rectangle(

lpcrect lprect

); rectangle(hdc,int left,int top,int rigth,int buttom);

2.ellipse //橢圓

bool rectangle(

int x1,

int y1,

int x2,

int y2

); bool rectangle(

lpcrect lprect

); ellipse(hdc hdc,int left,int top,int right,int buttom);

返回值 成功非零 否則為0.

3.roundrect //帶圓角的矩形

bool roundrect(
int x1,

int y1,

int x2,

int y2,

int x3,

int y3

); bool roundrect(

lpcrect lprect,

point point

); roundrect(hdc hdc,int left ,int top,int right , int buttom ,int weight ,int hight);

成功非0,否則為0.

4.arc //弧

bool arc(

int x1,

int y1,

int x2,

int y2,

int x3,

int y3,

int x4,

int y4

); bool arc(

lpcrect lprect,

point ptstart,

point ptend

); arc(hdc hdc,int left,int top,int right,int buttom ,int x3,int y3,int x4,int y4 );

(x3,y3)為起始點 ,(x4,y4)為終點(並不一定在弧上)。

弧不封閉。

5.chord //帶弦弧

bool chord(

int x1,

int y1,

int x2,

int y2,

int x3,

int y3,

int x4,

int y4

); bool chord(

lpcrect lprect,

point ptstart,

point ptend

); 引數和arc相同 ,比arc多一條弦,構成封閉圖形。

6.pie //扇形

bool pie(
int x1,

int y1,

int x2,

int y2,

int x3,

int y3,

int x4,

int y4

); bool pie(

lpcrect lprect,

point ptstart,

point ptend

); 引數和arc,chord相同,由弧和起始線加終線構成封閉圖形。

舉例:

case wm_paint:

hdc = beginpaint(hwnd, &ps);

//矩形

rectangle(hdc, cxclient / 4, cyclient / 4, cxclient * 3 / 4, cyclient * 3 / 4);

//橢圓

ellipse(hdc, cxclient / 4, cyclient / 4, cxclient * 3 / 4, cyclient * 3 / 4);

//稜角為弧的矩形

roundrect(hdc, cxclient / 4, cyclient / 4, cxclient * 3 / 4, cyclient * 3 / 4, cxclient / 8, cyclient / 8);

//弧arc(hdc, cxclient / 4, cyclient / 4, cxclient * 3 / 4, cyclient * 3 / 4,cxclient/2,0,0,cyclient/2);

//帶弦弧

chord(hdc, cxclient / 4, cyclient / 4, cxclient * 3 / 4, cyclient * 3 / 4, cxclient / 2, 0, 0, cyclient / 2);

//扇形

pie(hdc, cxclient / 4, cyclient / 4, cxclient * 3 / 4, cyclient * 3 / 4, cxclient / 2, 0, 0, cyclient / 2);

endpaint(hwnd, &ps);

return 0;

Win32 程序相關的API

開啟程序控制代碼 通過程序id 開啟模組控制代碼 基址 根據程序控制代碼 模組名 獲取模組的檔案全路徑 根據程序控制代碼 模組控制代碼 獲取模組的檔名 根據程序控制代碼 模組控制代碼 獲取模組的映象大小 入口位址 通過程序控制代碼 模組起始位址 讀取程序的記憶體 獲取程序的所有模組的控制代碼 inc...

win32彙編使用win32 api實現字串拷貝

字串拷貝,呼叫win32的lstrcpy函式 拷貝了以後用訊息框顯示一下 386 model flat,stdcall option casemap none include s masm32 include windows.inc include s masm32 include user32.i...

Win32程式設計

win32 malloc函式的底層實現是win32api utf 16編碼以16位無符號整數為單位,注意是16位為乙個單位,不是乙個字元就只有16位,這個要看字元的unicode編碼處於什麼範圍而定,有可能是2個位元組,也可能是4個位元組現在機器上的unicode編碼一般就是指utf 16 以兩個位...