⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 windowex.hpp

📁 一个完整的桌面日历程序
💻 HPP
📖 第 1 页 / 共 2 页
字号:
						}
						if(bSendNCPaintMsg)
							pWnd->SendMessage(WM_NCPAINT);
						if(lDelayCurrent > 0L)
						{
							Wait(lDelayCurrent);
							lDelayCurrent = max(0L, (lDelayCurrent + lDelayAcc));
						}
					};
				}
				break;
			}
			case eDir_Top2Bottom: 
			{
				if(pWnd->IsWindowVisible())
				{
					// Slide to invisible.
					irWindow_Begin = ::GetWindowRectEx(pWnd);
					iWidth = irWindow_Begin.Width();
					while(irWindow_Begin != irWindow_End) // At 0 height to end with.
					{
						++irWindow_Begin.top;
						pWnd->SetWindowPos(&pWnd->wndTop, 
										   irWindow_Begin.left, 
										   irWindow_Begin.top, 
										   iWidth, 
										   irWindow_Begin.bottom - irWindow_Begin.top, 
										   uFlags);
						if(pdc_shadow_client)
						{
							pdc_client->BitBlt(
								0, 
								0, 
								irClient_Final.right, 
								irClient_Final.bottom, 
								pdc_shadow_client, 
								0, 
								0, 
								SRCCOPY);
						}
						else
							pWnd->SendMessage(WM_PAINT);
						if(pdc_shadow_non_client)
						{
							// No impl.
						}
						if(bSendNCPaintMsg)
							pWnd->SendMessage(WM_NCPAINT);
						if(lDelayCurrent > 0L)
						{
							Wait(lDelayCurrent);
							lDelayCurrent = max(0L, (lDelayCurrent + lDelayAcc));
						}
					};
					pWnd->ShowWindow(SW_HIDE);
				}
				else
				{
					// Slide to visible.
					iWidth = irWindow_End.Width();
					irWindow_Begin.Set(
						irWindow_End.left, 
						irWindow_End.top,
						irWindow_End.right, 
						irWindow_End.top); // At 0 height to begin with.
					pWnd->ShowWindow(SW_SHOW);
					while(irWindow_Begin != irWindow_End)
					{
						++irWindow_Begin.bottom;
						iHeight = irWindow_Begin.bottom - irWindow_Begin.top;
						pWnd->SetWindowPos(&pWnd->wndTop, 
										   irWindow_Begin.left, 
										   irWindow_Begin.top, 
										   iWidth, 
										   iHeight, 
										   uFlags);
						if(pdc_shadow_client)
						{
							pdc_client->BitBlt(
								0, 
								0, 
								irClient_Final.right, 
								irClient_Final.bottom, 
								pdc_shadow_client, 
								0, 
								irClient_Final.bottom - iHeight, 
								SRCCOPY);
						}
						else
							pWnd->SendMessage(WM_PAINT);
						if(pdc_shadow_non_client)
						{
							// No impl.
						}
						if(bSendNCPaintMsg)
							pWnd->SendMessage(WM_NCPAINT);
						if(lDelayCurrent > 0L)
						{
							Wait(lDelayCurrent);
							lDelayCurrent = max(0L, (lDelayCurrent + lDelayAcc));
						}
					};
				}
				break;
			}
			case eDir_Right2Left:
			{
				if(pWnd->IsWindowVisible())
				{
					// Slide to invisible.
					irWindow_Begin = ::GetWindowRectEx(pWnd);
					iHeight = irWindow_Begin.Height();
					while(irWindow_Begin != irWindow_End) // At 0 height to end with.
					{
						--irWindow_Begin.right;
						iWidth = irWindow_Begin.right - irWindow_Begin.left;
						pWnd->SetWindowPos(&pWnd->wndTop, 
										   irWindow_Begin.left, 
										   irWindow_Begin.top, 
										   iWidth, 
										   iHeight, 
										   uFlags);
						if(pdc_shadow_client)
						{
							pdc_client->BitBlt(
								0, 
								0, 
								irClient_Final.right, 
								irClient_Final.bottom, 
								pdc_shadow_client, 
								irClient_Final.right - iWidth, 
								0, 
								SRCCOPY);
						}
						else
							pWnd->SendMessage(WM_PAINT);
						if(pdc_shadow_non_client)
						{
							// No impl.
						}
						if(bSendNCPaintMsg)
							pWnd->SendMessage(WM_NCPAINT);
						if(lDelayCurrent > 0L)
						{
							Wait(lDelayCurrent);
							lDelayCurrent = max(0L, (lDelayCurrent + lDelayAcc));
						}
					};
					pWnd->ShowWindow(SW_HIDE);
				}
				else
				{
					// Slide to visible.
					iHeight = irWindow_End.Height();
					irWindow_Begin.Set(
						irWindow_End.right, // At 0 width to begin with.
						irWindow_End.top, 
						irWindow_End.right, 
						irWindow_End.bottom);
					pWnd->ShowWindow(SW_SHOW);
					while(irWindow_Begin != irWindow_End) // At 0 height to end with.
					{
						--irWindow_Begin.left;
						pWnd->SetWindowPos(&pWnd->wndTop, 
										   irWindow_Begin.left, 
										   irWindow_Begin.top, 
										   irWindow_Begin.right - irWindow_Begin.left, 
										   iHeight, 
										   uFlags);
						if(pdc_shadow_client)
						{
							pdc_client->BitBlt(
								0, 
								0, 
								irClient_Final.right, 
								irClient_Final.bottom, 
								pdc_shadow_client, 
								0, 
								0, 
								SRCCOPY);
						}
						else
							pWnd->SendMessage(WM_PAINT);
						if(pdc_shadow_non_client)
						{
							// No impl.
						}
						if(bSendNCPaintMsg)
							pWnd->SendMessage(WM_NCPAINT);
						if(lDelayCurrent > 0L)
						{
							Wait(lDelayCurrent);
							lDelayCurrent = max(0L, (lDelayCurrent + lDelayAcc));
						}
					};
				}
				break;
			}
			case eDir_Bottom2Top:
			{
				if(pWnd->IsWindowVisible())
				{
					// Slide to invisible.
					irWindow_Begin = ::GetWindowRectEx(pWnd);
					iWidth = irWindow_Begin.Width();
					while(irWindow_Begin != irWindow_End) // At 0 height to end with.
					{
						--irWindow_Begin.bottom;
						iHeight = irWindow_Begin.bottom - irWindow_Begin.top;
						pWnd->SetWindowPos(&pWnd->wndTop, 
										   irWindow_Begin.left, 
										   irWindow_Begin.top, 
										   iWidth, 
										   iHeight, 
										   uFlags);
						if(pdc_shadow_client)
						{
							pdc_client->BitBlt(
								0, 
								0, 
								irClient_Final.right, 
								irClient_Final.bottom, 
								pdc_shadow_client, 
								0, 
								irClient_Final.bottom - iHeight, 
								SRCCOPY);
						}
						else
							pWnd->SendMessage(WM_PAINT);
						if(pdc_shadow_non_client)
						{
							// No impl.
						}
						if(bSendNCPaintMsg)
							pWnd->SendMessage(WM_NCPAINT);
						if(lDelayCurrent > 0L)
						{
							Wait(lDelayCurrent);
							lDelayCurrent = max(0L, (lDelayCurrent + lDelayAcc));
						}
					};
					pWnd->ShowWindow(SW_HIDE);
				}
				else
				{
					// Slide to visible.
					iWidth = irWindow_End.Width();
					irWindow_Begin.Set(
						irWindow_End.left, 
						irWindow_End.bottom, // At 0 height to begin with.
						irWindow_End.right, 
						irWindow_End.bottom);
					pWnd->ShowWindow(SW_SHOW);
					while(irWindow_Begin != irWindow_End)
					{
						--irWindow_Begin.top;
						pWnd->SetWindowPos(&pWnd->wndTop, 
										   irWindow_Begin.left, 
										   irWindow_Begin.top, 
										   iWidth, 
										   irWindow_Begin.bottom - irWindow_Begin.top, 
										   uFlags);
						if(pdc_shadow_client)
						{
							pdc_client->BitBlt(
								0, 
								0, 
								irClient_Final.right, 
								irClient_Final.bottom, 
								pdc_shadow_client, 
								0, 
								0, 
								SRCCOPY);
						}
						else
							pWnd->SendMessage(WM_PAINT);
						if(pdc_shadow_non_client)
						{
							// No impl.
						}
						if(bSendNCPaintMsg)
							pWnd->SendMessage(WM_NCPAINT);
						if(lDelayCurrent > 0L)
						{
							Wait(lDelayCurrent);
							lDelayCurrent = max(0L, (lDelayCurrent + lDelayAcc));
						}
					};
				}
				break;
			}
		}
		pWnd->ReleaseDC(pdc_client);
		pWnd->ReleaseDC(pdc_non_client);
	}
	catch(...)
	{
	}
}

inline const void Wait(const long lCount_End)
// Do something to delay the thread.
{
	long lSomething = 1000L;
	for(long lCount = 0L; lCount < lCount_End; lCount++)
	{
		lSomething /= 2;
		lSomething *= 2;
	}
}

inline const bool WndCenter(const HWND &hWindow)
// Center window.
{
	CRectEx irWindow;
	const CRectEx irScreen(GetScreenRect());
	if(::GetWindowRect(hWindow, (LPRECT)&irWindow))
		return(::MoveWindow(hWindow,
							(int)(0.5f * (irScreen.Width() - irWindow.Width())),
							(int)(0.5f * (irScreen.Height() - irWindow.Height())),
							(int)(irWindow.Width()),
							(int)(irWindow.Height()),
							TRUE) == TRUE);
		else
			return false;
}

inline const bool WndCenter(const HWND &hWindow, const float fWidth, const float fHeight)
// Center and size window.
{
	const CRectEx irScreen(GetScreenRect());
	return(::MoveWindow(hWindow,
						(int)(0.5f * (1.0f - fWidth) * irScreen.Width()),
						(int)(0.5f * (1.0f - fHeight) * irScreen.Height()),
						(int)(fWidth * irScreen.Width()),
						(int)(fHeight * irScreen.Height()),
						TRUE) == TRUE);
}

inline const bool WndCenter(const HWND &hWindow, const int iWidth, const int iHeight)
// Center and size window.
{
	const CRectEx irScreen(GetScreenRect());
	return(::MoveWindow(hWindow,
						(int)(0.5f * (irScreen.Width() - iWidth)),
						(int)(0.5f * (irScreen.Height() - iHeight)),
						iWidth,
						iHeight,
						TRUE) == TRUE);
}

inline const bool WndPlace(const HWND &hWindow, const double dPct_X, const double dPct_Y)
// Center window.
{
	CRectEx irWindow;
	const CRectEx irScreen(GetScreenRect());
	if(::GetWindowRect(hWindow, (LPRECT)&irWindow))
		return(::MoveWindow(hWindow,
							(int)(dPct_X * (irScreen.Width() - irWindow.Width())),
							(int)(dPct_Y * (irScreen.Height() - irWindow.Height())),
							(int)(irWindow.Width()),
							(int)(irWindow.Height()),
							TRUE) == TRUE);
		else
			return false;
}

// ------------------------------------------------------------------------------------------------------------------------------------------------------
// -																																				  	-
// ------------------------------------------------------------------------------------------------------------------------------------------------------

// 0. Data. (alphabetical).
// 1. Object. (alphabetical).
// 2. Event's. (alphabetical).
// 3.0. Menu choice. (menu order).
// 3.1. Menu choice, enablers. (menu order).
// 4. Slaves. (alphabetical).
// 5. Other. (alphabetical).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -