Advertisement
Guest User

Untitled

a guest
Jan 25th, 2016
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. typedef void( * DRAWFUNC )( HBITMAP *hBmp, HDC *hDC , int width, int height);
  2.  
  3. class CreateButton
  4. {
  5.     public:
  6.         CreateButton(class CreateButton **wsk, RECT Region, DRAWFUNC newDrawFunc);
  7.         ~CreateButton();
  8.         void Destroy();
  9.  
  10.         void Redraw();
  11.     private:
  12.         HWND hwnd_Button;
  13.         HBITMAP hBmp;
  14.         HDC hDC;
  15.         DRAWFUNC DrawFunc;
  16.  
  17. };
  18. CreateButton::CreateButton(class CreateButton **wsk, RECT Region, DRAWFUNC newDrawFunc){
  19.     DrawFunc = newDrawFunc;
  20.     hwnd_Button = //tworzę okno o wymiarach "Region"
  21.     SetWindowLong(hwnd_Button, 0, (LONG)wsk); //przypisuję klasę do okna aby móc pobierać hdc do rysowania po kontrolce
  22. }
  23. ~CreateButton::CreateButton(){
  24.     ReleaseDC(hwnd_Button);
  25.     DeleteObject(hBmp);
  26. }
  27. void CreateButton::Redraw(){
  28.     DrawFunc(&hBmp, &hDC, /*width*/, /*height*/);
  29. }
  30. void CreateButton::Destroy(){
  31.     DestroyWindow(hwnd_Button);
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement