Changeset 500 for trunk/src/user32/new/static.cpp
- Timestamp:
- Aug 15, 1999, 9:11:02 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/new/static.cpp
r387 r500 1 /* $Id: static.cpp,v 1. 4 1999-07-24 17:10:26cbratschi Exp $ */1 /* $Id: static.cpp,v 1.5 1999-08-15 19:11:01 cbratschi Exp $ */ 2 2 /* 3 3 * Static control … … 83 83 * Set the bitmap for an SS_BITMAP control. 84 84 */ 85 static HBITMAP STATIC_SetBitmap( HWND hwnd, HBITMAP h bitmap )86 { 87 HBITMAP prevIcon;85 static HBITMAP STATIC_SetBitmap( HWND hwnd, HBITMAP hBitmap ) 86 { 87 HBITMAP hOldBitmap; 88 88 STATICINFO *infoPtr = (STATICINFO *)GetInfoPtr(hwnd); 89 89 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); … … 91 91 if ((dwStyle & SS_TYPEMASK) != SS_BITMAP) return 0; 92 92 93 if (infoPtr->hIcon) DeleteObject(infoPtr->hIcon); 94 prevIcon = infoPtr->hIcon; 95 infoPtr->hIcon = hbitmap; 96 97 if (hbitmap) 93 if (hBitmap && GetObjectType(hBitmap) != OBJ_BITMAP) { 94 //ERR("huh? hBitmap!=0, but not bitmap\n"); 95 return 0; 96 } 97 hOldBitmap = infoPtr->hIcon; 98 infoPtr->hIcon = hBitmap; 99 if (hBitmap) 98 100 { 101 BITMAP bm; 102 GetObjectA(hBitmap, sizeof(bm), &bm); 103 SetWindowPos( hwnd, 0, 0, 0, bm.bmWidth, bm.bmHeight, 104 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER ); 105 /* CB: alternative code, if necessary 99 106 HDC hdc = GetDC(hwnd); 100 107 BITMAPINFO info; … … 106 113 } 107 114 ReleaseDC(hwnd,hdc); 108 } 109 110 return prevIcon;111 } 112 115 */ 116 117 } 118 return hOldBitmap; 119 } 113 120 114 121 /*********************************************************************** … … 535 542 hdc, hwnd ); 536 543 FillRect( hdc, &rc, hbrush ); 537 if (infoPtr->hIcon) 538 DrawIcon(hdc,0,0,infoPtr->hIcon); 544 545 if (infoPtr->hIcon) { 546 BITMAP bm; 547 SIZE sz; 548 549 if(GetObjectType(infoPtr->hIcon) != OBJ_BITMAP) 550 return; 551 if (!(hMemDC = CreateCompatibleDC( hdc ))) return; 552 GetObjectA(infoPtr->hIcon, sizeof(bm), &bm); 553 GetBitmapDimensionEx(infoPtr->hIcon, &sz); 554 oldbitmap = SelectObject(hMemDC, infoPtr->hIcon); 555 BitBlt(hdc, sz.cx, sz.cy, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, 556 SRCCOPY); 557 SelectObject(hMemDC, oldbitmap); 558 DeleteDC(hMemDC); 559 } 539 560 } 540 561
Note:
See TracChangeset
for help on using the changeset viewer.