不停的畫框的小程式

2021-04-15 14:45:39 字數 2035 閱讀 1625

#include

#include

#include "resource.h"

#define numlines ((int) (sizeof devcaps / sizeof devcaps [0]))

struct

devcaps = ;

lresult callback wndproc(hwnd hwnd, uint message, wparam wparam, lparam lparam);

void drawrectangle(hwnd hwnd);

return 0;}

hmenu hmenu = null;

hmenu = ::loadmenu(hinstance, makeintresource(idr_menu1));

::showwindow(hwnd, ncmdshow);

::updatewindow(hwnd);

while (true)

::translatemessage(&msg);

::dispatchmessage(&msg);

}else}

return msg.wparam;}

void drawrectangle(hwnd hwnd);

int  cxclient = 0;

int  cyclient = 0;

::getclientrect(hwnd, &rect);

cxclient = rect.right - rect.left;

cyclient = rect.bottom - rect.top;

::setrect(&rect, rand() % cxclient, rand() % cyclient, rand() % cxclient, rand() % cyclient);

hbrush = ::createsolidbrush(rgb(rand() % 256, rand() % 256, rand() % 256));

hdc = ::getdc(hwnd);

::fillrect(hdc, &rect, hbrush);

::releasedc(hwnd, hdc);

::deleteobject(hbrush);}

lresult callback wndproc(hwnd hwnd, uint message, wparam wparam, lparam lparam)

;textmetric tm   = ;

switch (message)

return 0;

case wm_paint:

::selectobject(hdc, ::getstockobject(null_brush));

::rectangle(hdc, 0, 0, 100, 50);

rect rect;

rect.left = 0;

rect.top = 60;

rect.bottom = 120;

rect.right = 200;

//::selectobject(hdc, ::getstockobject(gray_brush));

::framerect(hdc, &rect, (hbrush)::getstockobject(gray_brush));

rect.left = 0;

rect.top = 130;

rect.bottom = 200;

rect.right = 400;

//::fillrect(hdc, &rect, (hbrush)::getstockobject(white_brush));

::invertrect(hdc, &rect);

::endpaint(hwnd, &ps);

}return 0;

case wm_destroy:

return 0;

default:

break;}

return ::defwindowproc(hwnd, message, wparam, lparam);}

不停的畫框的小程式

include include include resource.h define numlines int sizeof devcaps sizeof devcaps 0 struct devcaps lresult callback wndproc hwnd hwnd,uint message,...

開源動畫框架Facebook的Pop

一提到動畫,首先想到的應該是pop,應用非常廣泛!接下來分享一些我所知道的,首先匯入pop,用cocoapod可以輕鬆匯入 pod pop 上最基礎的使用方法 1.import pop pop.h 2.彈出動畫 void showpopwithpopbutton uibutton abutton s...

小程式 小程式錄音功能的開發

最近做了乙個新年賀卡專案,專案除了平常的選擇賀卡和祝福語以外,還多了一項 錄下自己的祝福語音。這就有一丟丟為難我了,畢竟沒寫過,想著前同事寫的時候好像踩了不少坑,我也擔心我會踩坑。不過,真上手寫了,發現好像還不難。首先,我們在官網文件中找到與錄音有關的api,其中,recordermanager是全...