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);
}
分享到:
相关推荐
LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam); LRESULT OnEraseBkgnd(UINT message, WPARAM wParam, LPARAM lParam); LRESULT OnPaint(UINT message, WPARAM wParam, LPARAM lParam); ...
LRESULT CALLBACK CSDK::WndProc HWND hWnd UINT message WPARAM wParam LPARAM lParam { int wmId wmEvent; switch message { case WM COMMAND: wmId LOWORD wParam ; wmEvent HIWORD wParam ; ...
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_NCACTIVATE: // 当窗体激活时发生,这里选择忽略该消息 break; case WM_NC_PAINT: // 非...
LRESULT CMyWindow::WndProc(UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_LBUTTONDOWN: // 在这里处理鼠标左键被点击的逻辑 // 弹出一个对话框告知用户 MessageBox(NULL, _T(...
LRESULT SendMessage(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); ``` 参数解释: - `hWnd`:接收消息的窗口句柄。 - `msg`:指定要发送的消息类型,如WM_PAINT、WM_CHAR等。 - `wParam`:根据消息类型...
这两个消息分别用于绘制非客户区(如窗体边框)和客户区(如窗体内部内容)。 4. **处理WM_NCPAINT消息**: 当`WM_NCPAINT`消息到达时,这意味着需要绘制窗体的非客户区。这里,我们可以使用GDI(Graphics Device ...
在C++中,这通常通过继承`CWnd`类并在类中定义`afx_msg LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam)`函数来完成。在这个函数中,我们将处理WM_SYSCOMMAND消息。 2. **处理WM_SYSCOMMAND消息**...
LRESULT CALLBACK WndProc(HWND hWnd, UINT nMessage, WPARAM wParam, LPARAM lParam){ int i; for (i = 0; i (messageEntries); i ++){ if (nMessage == messageEntries[i].nMessage) return (*messageEntries...
BOOL CALLBACK DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); BOOL CALLBACK AboutProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); extern "C" __declspec(dllexport) void ...
LRESULT CALLBACK DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: return TRUE; case WM_SETFONT: //不常用控件消息处理 { ...
`PostMessage`函数就是这样的一个工具,它允许程序在目标窗口的message queue中放置一个消息,而不是立即处理它。这个功能在自动化测试、游戏外挂、远程控制软件等领域有广泛应用。在VC++(Microsoft Visual C++)...
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); // 主函数 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { // 注册...
5. **注意点**:在处理自定义消息时,确保消息处理函数的参数正确,通常为`LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)`。`wParam`和`lParam`可以传递额外的信息。 另一方面...
- 在窗口过程函数中处理WM_TIMER消息,如`LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)`。 3. **创建非消息驱动定时器** 非消息驱动定时器使用`CreateTimerQueueTimer()`...
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_COMMAND: // 处理标准控件消息 break; case customMsg: // 处理自定义消息 break; ...
LONG (*fun)(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); // 消息处理函数 }; ``` 这个结构体中的 `message` 成员变量用于保存特定的消息类型,而 `fun` 成员变量则指向一个处理该消息的函数。 ####...
PostMessage(TargetHandle, Message.Msg, Message.WParam, Message.LParam); end; ``` 这里 `AVirtualKeyCode` 是你要模拟的虚拟键码,例如 VK_A 对应 'A' 键。`TargetHandle` 是接收模拟按键事件的应用程序窗口的...
在Delphi编程中,API(Application Programming Interface)是操作系统提供给开发者用来访问系统资源的一组函数,它们允许程序员实现更底层的功能,例如控制窗口、绘制图形、处理输入等。本篇将深入探讨如何使用API...
void sendMessageToVC(HWND targetWindow, UINT message, WPARAM wParam, LPARAM lParam) { PostMessage(targetWindow, message, wParam, lParam); } ``` 在VC++项目中,我们首先需要链接到QT动态库,然后在代码中...
afx_msg LRESULT WndProc(UINT message, WPARAM wParam, LPARAM lParam); DECLARE_MESSAGE_MAP() }; ``` 2. **重写`WndProc`**:在`WndProc`函数中,你需要处理`WM_KEYDOWN`和`WM_KEYUP`消息。对于每个消息,你...