VC 窗体非客户区的绘制 OnNcPaint(UINT message, WPARAM wParam, LPARAM lParam)

void CSkinAndLangDlg::OnNcPaint(UINT message, WPARAM wParam, LPARAM lParam)
{
 	HDC WindowDC = ::GetWindowDC(m_hWnd);
// 	//取得整个窗体矩形
	RECT WindowRect;
	GetWindowRect(&WindowRect);
    OffsetRect(&WindowRect, -WindowRect.left, - WindowRect.top);
// 	//取得客户区矩形,并从WINDOWDC中排除不予绘制
// 	RECT ClientRect;
// 	GetClientRect(&ClientRect);
// 	OffsetRect(&ClientRect, BorderLeftWidth, BorderTopHeight);
// 	ExcludeClipRect(WindowDC, ClientRect.left, ClientRect.top, ClientRect.right, ClientRect.bottom);
	//窗体宽度和高度
// 	int width, height;
// 	width = WindowRect.right;
// 	height = WindowRect.bottom;
// 	//填充背景
// 	Bitmap bmp(width, height);
// 	Graphics* g = Graphics::FromImage(&bmp);
// 	SolidBrush sbr(Color(255,120,120,120));
// 	g->FillRectangle(&sbr, 0, 0, width, height);
// 
// 	Image *pImage = NULL;
// 	skinApp.LoadPng(1, (void*&)pImage);
// 	
// 	g->DrawImage(pImage, 0, 0);

// 	int x_CtrBox = width - CtrBoxWidth - 5;
// 	int y_CtrBox = 0;
// 	Pen pen(Color(255,128,128,128), 1);
// 	g->DrawRectangle(&pen, x_CtrBox, y_CtrBox, CtrBoxWidth, CtrBoxHeight);
// 	//最小化按钮
// 	pen.SetWidth(2);
// 	g->DrawLine(&pen, x_CtrBox + 3, y_CtrBox + CtrBoxHeight / 2,
// 		x_CtrBox + CtrBoxWidth / 3 - 3, y_CtrBox + CtrBoxHeight / 2);
	//最大化按钮
// 	g->DrawLine(&pen, 
// 		x_CtrBox + CtrBoxWidth + 3, 
// 		y_CtrBox + 5,
// 		CtrBoxWidth / 3 - 6, 
// 		CtrBoxWidth / 3 - 6);
	//关闭按钮
// 	g->DrawLine(&pen, 
// 		x_CtrBox + CtrBoxWidth / 3 * 2 + 3, 
// 		y_CtrBox + 3,
// 		x_CtrBox + CtrBoxWidth - 3, 
// 		y_CtrBox + CtrBoxHeight - 3);
// 	g->DrawLine(&pen, 
// 		x_CtrBox + CtrBoxWidth - 3, 
// 		y_CtrBox + 3,
// 		x_CtrBox + CtrBoxWidth / 3 * 2 + 3, 
// 		y_CtrBox + CtrBoxHeight - 3);
	
	
	Graphics g2(WindowDC);

	SolidBrush sbr(Color(255,120,120,120));
	//左侧边框
    g2.FillRectangle(&sbr, 0, BorderTopHeight, BorderLeftWidth, WindowRect.bottom);
	//右侧边框
	g2.FillRectangle(&sbr, WindowRect.right - BorderLeftWidth, BorderTopHeight, WindowRect.right - BorderLeftWidth, WindowRect.bottom);
	//下边框
	g2.FillRectangle(&sbr, 0, WindowRect.bottom - BorderLeftWidth, WindowRect.right, WindowRect.bottom);

	Image *pImage = NULL;
	CDefaultSkinApp::LoadPng(1, (void*&)pImage);
	
	Image *pImg = pImage->GetThumbnailImage(WindowRect.right, BorderTopHeight, NULL, NULL);
	TRACE(_T("WindowRect.right = %d\n"), WindowRect.right);
	g2.DrawImage(pImg, 0, 0, pImg->GetWidth(), pImg->GetHeight());
	delete pImg;
	
	::ReleaseDC(m_hWnd, WindowDC);

}

你可能感兴趣的:(image,null,delete)