Home > Software engineering >  MFC SDI in the client area map, the response after NcPaint menu bar are covered, how to refresh the
MFC SDI in the client area map, the response after NcPaint menu bar are covered, how to refresh the

Time:09-22

Rt
I response in the DefWindowProc WM_NCPAINT, in the client area map, found that original system menu items are covered, only after the mouse went up, according to what's the problem?

CodePudding user response:

Please reply warrior ah, make uncertain

CodePudding user response:

In the client area map? The title bar?
Mobile location

CodePudding user response:

refer to the second floor schlafenhamster response:
in the client area map? The title bar?
Mobile location

Where is the maximize, minimize button with company logo on the cover, need not maximize, minimize button, the icon is larger and company

CodePudding user response:

"Maximize, minimize button" can not program creates,

CodePudding user response:

reference 4 floor schlafenhamster response:
"maximize, minimize button" can not program creates,

I didn't say clear, I mean to maximize, the location of the minimize button on the logo of the company

CodePudding user response:

That can only be again draw a button

//
CRect rc;
Rc. Right=rcWin. Width ();
Rc. Left=rc. Right - sizeButton. Cx.
Rc. Top=rcWin. Top + 3;
Rc. Bottom=sizeButton. Cy + 3;
//
PWinDC - & gt; DrawFrameControl (rc, DFC_CAPTION DFCS_CAPTION CLOSE );
Rc. OffsetRect (- sizeButton. Cx - 3, 0);
PWinDC - & gt; DrawFrameControl (rc, DFC_CAPTION DFCS_CAPTIONMAX);
Cx, rc. OffsetRect (- sizeButton. 0);
PWinDC - & gt; DrawFrameControl (rc, DFC_CAPTION DFCS_CAPTIONMIN);

CodePudding user response:

,
Problem description is not very clear, as shown, the response NCPAINT with company logo in yellow area, the system menu items are covered, how should solve?

CodePudding user response:

The system menu item??
Menu bar?
M_wndMenu. Invalidate

CodePudding user response:

refer to the eighth floor schlafenhamster response:
system menu item??
Menu bar?
M_wndMenu. Invalidate

Try the along while, found is the red area can not refresh, switch the view menu will not be updated, menu items already exists, is to be the mouse moved to the top is displayed

CodePudding user response:

Then take a look at your code

CodePudding user response:

The
references to the tenth floor schlafenhamster response:
: just look at your code

LRESULT CMainFrame: : DefWindowProc (UINT message, WPARAM WPARAM, LPARAM LPARAM)
{
If (message==WM_MOVE | | message==WM_NCPAINT | | message==WM_NCACTIVATE | | message==WM_NOTIFY)
{
The CDC * pWinDC=GetWindowDC ();
If (pWinDC)
DrawFrame (pWinDC);//custom redraw function
The ReleaseDC (pWinDC);
return TRUE;
}
The else
Return CFrameWnd: : DefWindowProc (message, wParam, lParam);
}

Void CMainFrame: : DrawFrame (pDC) CDC *
{
The CDC * pDisplayMemDC=new CDC;
PDisplayMemDC - & gt; CreateCompatibleDC (pDC);
//used to save window button position, frame and title bar location of temporary variable
CRect rtWnd rtButtons, rtTitle rtIcon;
////get the window position
GetWindowRect (& amp; RtWnd);

//get the title bar position
RtTitle. Top=GetSystemMetrics (SM_CYFRAME);
RtTitle. Left=GetSystemMetrics (SM_CXFRAME);
RtTitle. Bottom=GetSystemMetrics (SM_CYFRAME) + GetSystemMetrics (SM_CYSIZE);
RtTitle. Right=rtWnd. Width () - GetSystemMetrics (SM_CXFRAME);

//to map
CBitmap * pBitmap=new CBitmap;
BITMAP bm.

//to redraw the close button
PBitmap - & gt; LoadBitmap (IDB_TKLOGO);
PBitmap - & gt; GetBitmap (& amp; Bm);
PDisplayMemDC - & gt; SelectObject (pBitmap);
//set the position close button
RtButtons. Left=rtTitle. Right - bm. BmWidth - 5;
RtButtons. Top=GetSystemMetrics (SM_CYFRAME) + (rtTitle. Height () - bm. BmHeight)/2;
=rtButtons rtButtons. Right. The left + bm. BmWidth;
RtButtons. Bottom=rtButtons. Top + bm. BmHeight - 2;

//redraw close button
PDC - & gt; BitBlt (rtButtons rtButtons. Left, top, rtButtons. The Width (), rtButtons. Height (), pDisplayMemDC, 0, 0, SRCCOPY);
PBitmap - & gt; DeleteObject ();

//to prepare heavy drawing
RtIcon. Left=GetSystemMetrics (SM_CXFRAME);
RtIcon. Top=GetSystemMetrics (SM_CYFRAME);
RtIcon. Right=rtIcon. Left + GetSystemMetrics (SM_CXSIZE);
RtIcon. Bottom=rtIcon. Top + GetSystemMetrics (SM_CYSIZE);
//: : DrawIconEx (pDC - & gt; M_hDC, rtIcon left, rtIcon. Top AfxGetApp () - & gt; LoadIcon (IDR_MAINFRAME),
//rtIcon. Width (), rtIcon Height (), 0, NULL, DI_NORMAL);

//draw the title
PDC - & gt; SetBkMode (TRANSPARENT);
CFont * pOldFont;
CFont ft;
Ft. CreatePointFont (120, "tahoma");
POldFont=pDC - & gt; SelectObject (& amp; Ft);
PDC - & gt; DrawText (_T (XXXXX "system"), CRect (rtIcon left, GetSystemMetrics (SM_CYFRAME) - 6400, GetSystemMetrics (SM_CYSIZE) + 20), DT_NOCLIP | DT_SINGLELINE);
PDC - & gt; SelectObject (pOldFont);

The ReleaseDC (pDisplayMemDC);
The delete pDisplayMemDC;
The delete pBitmap;
}
Do these operations, I have a question, how to refresh the specific area of the client area, rather than the entire client area is the refresh?

CodePudding user response:

Try
 
LRESULT CMainFrame: : DefWindowProc (UINT message, WPARAM WPARAM, LPARAM LPARAM)
{
LRESULT ret=CFrameWnd: : DefWindowProc (message, wParam, lParam); //default first

If (message==WM_MOVE | | message==WM_NCPAINT | | message==WM_NCACTIVATE | | message==WM_NOTIFY)
{
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related