diff options
author | George Hazan <george.hazan@gmail.com> | 2013-02-17 12:38:33 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-02-17 12:38:33 +0000 |
commit | d9f1ce1a3740f213cd0b43085a399bd03f64f200 (patch) | |
tree | e6e663b1ff92fb9780332a9318cfbfcb4c399c6d /src/modules/options/iconheader.cpp | |
parent | 2ecfefaea1ef0eb0a9a85795d5ac0168b757d3ff (diff) |
gdi resources cleaning patch
git-svn-id: http://svn.miranda-ng.org/main/trunk@3621 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/options/iconheader.cpp')
-rw-r--r-- | src/modules/options/iconheader.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/modules/options/iconheader.cpp b/src/modules/options/iconheader.cpp index 0bdbd3209d..6b51a0afe9 100644 --- a/src/modules/options/iconheader.cpp +++ b/src/modules/options/iconheader.cpp @@ -258,15 +258,10 @@ static void MIcoTab_DrawItem(HWND hwnd, HDC hdc, MIcoTabCtrl *dat, MIcoTab *tab, static LRESULT MIcoTab_OnPaint(HWND hwndDlg, MIcoTabCtrl *mit, UINT msg, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
- HBITMAP hBmp, hOldBmp;
- RECT temprc;
- int i;
HDC hdc = BeginPaint(hwndDlg, &ps);
HDC tempDC = CreateCompatibleDC(hdc);
- HFONT hFont = 0;
-
BITMAPINFO bmi;
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = mit->width;
@@ -274,11 +269,12 @@ static LRESULT MIcoTab_OnPaint(HWND hwndDlg, MIcoTabCtrl *mit, UINT msg, WPARAM bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biCompression = BI_RGB;
- hBmp = CreateDIBSection(tempDC, &bmi, DIB_RGB_COLORS, NULL, NULL, 0);
+ HBITMAP hBmp = CreateDIBSection(tempDC, &bmi, DIB_RGB_COLORS, NULL, NULL, 0);
- hOldBmp = (HBITMAP)SelectObject(tempDC, hBmp);
+ HBITMAP hOldBmp = (HBITMAP)SelectObject(tempDC, hBmp);
if (IsAeroMode()) {
+ RECT temprc;
temprc.left = 0;
temprc.right = mit->width;
temprc.top = 0;
@@ -299,11 +295,11 @@ static LRESULT MIcoTab_OnPaint(HWND hwndDlg, MIcoTabCtrl *mit, UINT msg, WPARAM } }
//Draw Items
- hFont = mit->hFont;
- SelectObject(tempDC, hFont);
+ HFONT hFont = mit->hFont;
+ HFONT hOldFont = (HFONT)SelectObject(tempDC, hFont);
SetBkMode(tempDC, TRANSPARENT);
- for (i=0; i<mit->pList.getCount(); i++) {
+ for (int i=0; i<mit->pList.getCount(); i++) {
MIcoTab *tab = (MIcoTab *)mit->pList[i];
MIcoTab_DrawItem(hwndDlg, tempDC, mit, tab, i);
}
@@ -312,6 +308,7 @@ static LRESULT MIcoTab_OnPaint(HWND hwndDlg, MIcoTabCtrl *mit, UINT msg, WPARAM BitBlt(hdc, mit->rc.left, mit->rc.top, mit->width, mit->height, tempDC, 0, 0, SRCCOPY);
SelectObject(tempDC, hOldBmp);
DeleteObject(hBmp);
+ SelectObject(tempDC,hOldFont);
DeleteDC(tempDC);
EndPaint(hwndDlg, &ps);
|