WEB开发网
开发学院手机开发Windows Mobile 开发 Windows Mobile 使用GDI实现BUTTON效果 阅读

Windows Mobile 使用GDI实现BUTTON效果

 2010-08-23 05:19:00 来源:WEB开发网   
核心提示:{rc[m_nCurrentCount] = rc;}void MyButton::InitButtonImage(HWND hWnd){HDC hdc = GetDC(hWnd);// 利用双缓冲绘图for(int n = 0; n < m_nCurrentCount; n ++){HDC hMemDc = C

{

rc[m_nCurrentCount] = rc;

}

void MyButton::InitButtonImage(HWND hWnd)

{

HDC hdc = GetDC(hWnd);

// 利用双缓冲绘图

for(int n = 0; n < m_nCurrentCount; n ++)

{

HDC hMemDc = CreateCompatibleDC(hdc);

HBITMAP hOldBmp = (HBITMAP)SelectObject(hMemDc, hDownBitmap[m_nCurrentCount]);

BITMAP bm;

GetObject(hDownBitmap[m_nCurrentCount], sizeof(bm), &bm);

StretchBlt(hdc, rc[m_nCurrentCount].left, rc[m_nCurrentCount].top, rc[m_nCurrentCount].right - rc[m_nCurrentCount].left, rc[m_nCurrentCount].bottom - rc[m_nCurrentCount].top, &dcSrc, 0, 0, nWidthOld, nHeightOld, SRCCOPY);

BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hMemDc, 0, 0, SRCCOPY);

SelectObject(hMemDc, hOldBmp);

DeleteDC(hMemDc);

}

}

void MyButton::InitButtonImage(HWND hWnd)

{

HDC hdc = GetDC(hWnd);

// 利用双缓冲绘图

for(int n = 0; n < m_nCurrentCount; n ++)

{

HDC hMemDc = CreateCompatibleDC(hdc);

HBITMAP hOldBmp = (HBITMAP)SelectObject(hMemDc, hDownBitmap[m_nCurrentCount]);

BITMAP bm;

GetObject(hDownBitmap[m_nCurrentCount], sizeof(bm), &bm);

StretchBlt(hdc, rc[m_nCurrentCount].left, rc[m_nCurrentCount].top, rc[m_nCurrentCount].right - rc[m_nCurrentCount].left, rc[m_nCurrentCount].bottom - rc[m_nCurrentCount].top, &dcSrc, 0, 0, nWidthOld, nHeightOld, SRCCOPY);

SelectObject(hMemDc, hOldBmp);

DeleteDC(hMemDc);

}

}

void MyButton::SetUpButtonImage(HWND hWnd, int nSel)

{

HDC hdc = GetDC(hWnd);

CRect rcSel;

rcSel = rc[nSel];

m_nPreSel = nSel;

// 利用双缓冲绘图

HDC hMemDc = CreateCompatibleDC(hdc);

Tags:Windows Mobile 使用

编辑录入:coldstar [复制链接] [打 印]
赞助商链接