Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef void( * DRAWFUNC )( HBITMAP *hBmp, HDC *hDC , int width, int height);
- class CreateButton
- {
- public:
- CreateButton(class CreateButton **wsk, RECT Region, DRAWFUNC newDrawFunc);
- ~CreateButton();
- void Destroy();
- void Redraw();
- private:
- HWND hwnd_Button;
- HBITMAP hBmp;
- HDC hDC;
- DRAWFUNC DrawFunc;
- };
- CreateButton::CreateButton(class CreateButton **wsk, RECT Region, DRAWFUNC newDrawFunc){
- DrawFunc = newDrawFunc;
- hwnd_Button = //tworzę okno o wymiarach "Region"
- SetWindowLong(hwnd_Button, 0, (LONG)wsk); //przypisuję klasę do okna aby móc pobierać hdc do rysowania po kontrolce
- }
- ~CreateButton::CreateButton(){
- ReleaseDC(hwnd_Button);
- DeleteObject(hBmp);
- }
- void CreateButton::Redraw(){
- DrawFunc(&hBmp, &hDC, /*width*/, /*height*/);
- }
- void CreateButton::Destroy(){
- DestroyWindow(hwnd_Button);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement