为什么给按钮加背景BITMAP没效果?
为什么给按钮加背景BITMAP没效果?程序代码:
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) { HWND hWnd; PAINTSTRUCT ps; hInst = hInstance; // 将实例句柄存储在全局变量中 hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); HWND HB1=CreateWindow(_T("button"),_T(""),BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE, 10, 15, 70, 50, hWnd, (HMENU)IDB_BITMAP1, NULL, NULL); HDC hdc=GetDC(HB1); HBITMAP bitmap=LoadBitmap (hInstance,MAKEINTRESOURCE(IDB_BITMAP1)); HDC hdcsource = CreateCompatibleDC(NULL);//创建存放图象的显示缓冲 SelectObject(hdcsource,bitmap); //将位图资源装入显示缓冲 if(BitBlt(hdc,0,0,50,50,hdcsource,50,50,SRCCOPY)) MessageBox(NULL,_T("123"),_T("123"),0);//将图象显示缓冲的内容直接显示到屏幕 ReleaseDC(HB1,hdc); if (!hWnd) { return FALSE; } ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd); return TRUE; }
[ 本帖最后由 我是菜鸟哦 于 2011-9-30 19:19 编辑 ]