DuiLib无边框窗口在win10下的最小化/还原特效消失的问题,真正的无边框窗口实现

不爱啰嗦,直接上代码

int ProcNCCalcSize(UINT message, WPARAM wParam, LPARAM lParam)
{
	int xFrame = 0; /*左右边框的厚度*/
	int yFrame = 0; /*下边框的厚度*/
	int nTHight = 0; /*标题栏的高度*/
	NCCALCSIZE_PARAMS * p;
	RECT * rc;


	RECT aRect;
	RECT bRect;
	RECT bcRect;

		

	if (wParam == TRUE)
	{
		p = (NCCALCSIZE_PARAMS *)lParam; /*矩形是B A AC,目标是改成BC B A*/


		CopyRect(&aRect, &p->rgrc[1]);
		CopyRect(&bRect, &p->rgrc[0]);


		//修正最大化时无边框窗口客户区的偏移
		if (bRect.left < 0)
		{
			bRect.right += bRect.left;
			bRect.left = 0;
		}

		if (bRect.top < 0)
		{
			bRect.bottom += bRect.top;
			bRect.top = 0;
		}

		/*指定BC的矩形的位置*/
		bcRect.left = bRect.left + xFrame;
		bcRect.top = bRect.top + nTHight;
		bcRect.right = bRect.right - xFrame;
		bcRect.bottom = bRect.bottom - yFrame;


		/*各个矩形归位*/
		CopyRect(&p->rgrc[0], &bcRect);
		CopyRect(&p->rgrc[1], &bRect);
		CopyRect(&p->rgrc[2], &aRect);
	}
	else
	{
		rc = (RECT *)lParam;


		rc->left = rc->left + xFrame;
		rc->top = rc->top + nTHight;
		rc->right = rc->right - xFrame;
		rc->bottom = rc->bottom - yFrame;
	}
	return GetLastError();
}

 

你可能感兴趣的:(C++,UI+GDI,Win32,SDK)