tailieunhanh - Lập trình sự kiện - các thư viện lập trình của windows - trần minh thái - 4

Bài 4: Hộp thọai và điều khiển DeleteObject((HGDIOBJ)SetClassLong(hw nd, GCL_HBRBACKGROUND,(LONG) GetStockObject (WHITE_BRUSH))) ; PostQuitMessage (0) ; return 0 ; } return DefWindowProc (hwnd, message, wParam, lParam); } void PaintTheBlock (HWND hCtrl, int iColor[], int iFigure) { InvalidateRect (hCtrl, NULL, TRUE); UpdateWindow (hCtrl) ; PaintWindow (hCtrl, iColor, iFigure) ; } BOOL CALLBACK ColorScrDlg (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { HWND hwndParent, hCtrl ; static HWND hCtrlBlock ; int iCtrlID, iIndex ; switch (message) { case WM_INITDIALOG : hCtrlBlock = GetDlgItem (hDlg, IDC_PAINT) ; for (iCtrlID = 10 ; iCtrlID . | Bài 4 Hộp thọai và điều khiển Trần Minh Thái 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 DeleteObject HGDIOBJ SetClassLong hw nd GCL_HBRBACKGROUND LONG GetStockObject WHITE_BRUsH PostQuitMessage 0 return 0 return DefWindowProc hwnd message wParam lParam void PaintTheBlock HWND hCtrl int iColor int iFigure InvalidateRect hCtrl NULL TRUE UpdateWindow hCtrl PaintWindow hCtrl iColor iFigure BOOL CALLBACK ColorScrDlg HWND hDlg UINT message WPARAM wParam LPARAM lParam HWND hwndParent hCtrl static HWND hCtrlBlock int iCtrlID iIndex switch message case WMINITDIALOG hCtrlBlock GetDlgItem hDlg IDC_PAINT for iCtrlID 10 iCtrlID 13 iCtrlID hCtrl GetDlgItem hDlg iCtrlID PaintTheBlock hCtrlBlock iColor iFigure PaintTheBlock hwndParent iColor iFigure SetScrollRange hCtrl SB_CTL 0 255 FALSE SetScrollPos hCtrl SB_CTL 0 FALSE return TRUE case WM_COMMAND switch LOWORD wParam case IDC_RECT case IDC_ELLIPSE iFigure LOWORD wParam Bài giảng Lập trình C for Win Trang 55 69 Bài 4 Hộp thọai và điều khiển Trần Minh Thái 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 hwndParent GetParent hDlg CheckRadioButton hDlg IDC_RECT IDC_ELLIPSE LOWORD wParam PaintTheBlock hCtrlBlock iColor iFigure PaintTheBlock hwndParent iColor iFigure return TRUE break case WM_VSCROLL hCtrl HWND lParam iCtrlID GetWindowLong hCtrl GWL_ID iIndex iCtrlID - 10 hwndParent GetParent hDlg PaintTheBlock hCtrlBlock iColor iFigure PaintTheBlock hwndParent iColor iFigure switch LOWORD wParam case SB_PAGEDOWN iColor iIndex 15 case SB_LInEdOwN iColor iIndex min 255 iColor iIndex 1 break case SB_PAGEUP iColor iIndex - 15 case SB_LINEUP iColor iIndex max 0 iColor iIndex - 1 break case SB_TOP iColor iIndex 0 break case SB_BOTTOM iColor iIndex 255 break case SB_THUMBPOSITION case SB_THUMBTRACK iColor iIndex HIWORD wParam Bài giảng .

TỪ KHÓA LIÊN QUAN