LRESULT CALLBACK WndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam){static HRGN hRgnClip ; //創(chuàng)建hRgnClip 我想問的問題。static int cxClient, cyClient ;double fAngle, fRadius ; //角度,半徑HCURSOR hCursor ; //光標(biāo)句柄HDC hdc ;HRGN hRgnTemp[6] ; //范圍int i ;PAINTSTRUCT ps ; //繪圖結(jié)構(gòu)。switch (iMsg){case WM_SIZE:cxClient = LOWORD (lParam) ; //客戶區(qū)長cyClient = HIWORD (lParam) ; //客戶區(qū)高h(yuǎn)Cursor = SetCursor (LoadCursor (NULL, IDC_WAIT)) ; //// 函數(shù)功能:該函數(shù)確定光標(biāo)的形狀。ShowCursor (TRUE) ;//該函數(shù)顯示或隱藏光標(biāo)。if (hRgnClip) //為什么這么做呢?DeleteObject (hRgnClip) ; //hRgnClip 到這怎么就把他給刪除了?連初始化都沒做,也沒用到這個(gè)變量,就把他刪除,為什么要?jiǎng)?chuàng)建。hRgnTemp[0] = CreateEllipticRgn (0, cyClient / 3, cxClient / 2, 2 * cyClient / 3) ;//創(chuàng)建一個(gè)橢圓hRgnTemp[1] = CreateEllipticRgn (cxClient / 2, cyClient / 3, cxClient, 2 * cyClient / 3) ;hRgnTemp[2] = CreateEllipticRgn (cxClient / 3, 0, 2 * cxClient / 3, cyClient / 2) ;hRgnTemp[3] = CreateEllipticRgn (cxClient / 3, cyClient / 2, 2 * cxClient / 3, cyClient) ;hRgnTemp[4] = CreateRectRgn (0, 0, 1, 1) ;hRgnTemp[5] = CreateRectRgn (0, 0, 1, 1) ;hRgnClip = CreateRectRgn (0, 0, 1, 1) ; //
為什么刪除的變量又出現(xiàn)了,這是為什么?而且不會(huì)出錯(cuò) -0 - 不明白!跪求高手解疑惑。
烙印99
2022-08-04 18:14:29