在cmybutton中的drawitem和其他能画的地方都试了肯定没在背景上的pdc画
解决方案 »
- MFC怎么把打开一个TXT文件到编辑框里啊? 大哥大姐们都来救救我啊~~~
- 大家帮忙,分立即送上
- 我怎样能更改一个 StaticText 控件的内容,比如ID是IDC_STATIC,在线求教
- 初学: HOWTO: Get IHTMLDocument2 from a HWND
- 我用别的光标代替了EDIT控件(已经子类化)上的默认箭头光标,但它上面的1字光标总在闪烁,如何禁止它显示?不让它出现。
- 问一个有关工具栏的简单问题
- 我的Combo box怎么插不进去值啊?(在线)
- 请各位朋友指教:关于UCS2。
- DISPID_BEFORENAVIGATE2事件
- 作了一个查杀以把可执行文件以资源形式包装的病毒或木马的程序,大家试试看,说不定从你机上就能找出一大堆来.
- 有点难的问题——关于自定义格式的图形图像保存:)
- 请问:ATL project Debug编译通过,Release编译出错?
你的异形按钮如何得到的? SetWindowRgn?
你用于绘画的屏幕设备句柄如何得到的? 通过 DRAWITEMSTRUCT?
The DrawTextEx function draws formatted text in the specified rectangle.int DrawTextEx(
HDC hdc, // handle to DC
LPTSTR lpchText, // text to draw
int cchText, // length of text to draw
LPRECT lprc, // rectangle coordinates
UINT dwDTFormat, // formatting options
LPDRAWTEXTPARAMS lpDTParams // more formatting options
);
LPARAM lParam)
{
HDC hdcMem;
LPDRAWITEMSTRUCT lpdis;
switch (message)
{
case WM_INITDIALOG:
// hinst, hbm1 and hbm2 are defined globally.
hbm1 = LoadBitmap((HANDLE) hinst, "OwnBit1");
hbm2 = LoadBitmap((HANDLE) hinst, "OwnBit2");
return TRUE;
case WM_DRAWITEM:
lpdis = (LPDRAWITEMSTRUCT) lParam;
hdcMem = CreateCompatibleDC(lpdis->hDC);
if (lpdis->itemState & ODS_SELECTED) // if selected
SelectObject(hdcMem, hbm2);
else
SelectObject(hdcMem, hbm1);
// Destination
StretchBlt(
lpdis->hDC, // destination DC
lpdis->rcItem.left, // x upper left
lpdis->rcItem.top, // y upper left
// The next two lines specify the width and
// height.
lpdis->rcItem.right - lpdis->rcItem.left,
lpdis->rcItem.bottom - lpdis->rcItem.top,
hdcMem, // source device context
0, 0, // x and y upper left
32, // source bitmap width
32, // source bitmap height
SRCCOPY); // raster operation
DeleteDC(hdcMem);
return TRUE;
case WM_COMMAND:
if (wParam == IDOK
|| wParam == IDCANCEL)
{
EndDialog(hDlg, TRUE);
return TRUE;
}
if (HIWORD(wParam) == BN_CLICKED)
{
switch (LOWORD(wParam))
{
case IDC_OWNERDRAW:
// application-defined processing
break;
}
}
break;
case WM_DESTROY:
DeleteObject(hbm1); // delete bitmaps
DeleteObject(hbm2);
break;
}
return FALSE;
UNREFERENCED_PARAMETER(lParam);
}