Home > Software engineering >  How to modify the dialog box around the border color
How to modify the dialog box around the border color

Time:09-20

In the Settings dialog to adjust the colors of the dialog box border (not the background color dialog box), how to change?

CodePudding user response:

Recommend custom painting or map SetSysColors may lead to other application system have also been changed

CodePudding user response:

The simplest
SystemParametersInfo (SPI_SETDROPSHADOW, 0, (the PVOID) TRUE, 0).//- open shadows 
SystemParametersInfo (SPI_SETDROPSHADOW, 0, (the PVOID) FALSE, 0).//- shadows off
Complex is redrawn

CodePudding user response:

 CBrush Brush (RGB (187200143)); 
The CBrush * pOldBrush=pDC - & gt; SelectObject (& amp; Brush);

CRect rtWnd, rtTitle rtButtons;
GetWindowRect (& amp; RtWnd);
//get the position of the title bar
//SM_CXFRAME window frame edge width
//SM_CYFRAME the edge of the window frame height
//SM_CXSIZE window title bar width
//SM_CYSIZE window title bar height
RtTitle. Left=GetSystemMetrics (SM_CXFRAME);
RtTitle. Top=GetSystemMetrics (SM_CYFRAME);
- rtWnd rtTitle. Right=rtWnd. Right. The left - GetSystemMetrics (SM_CXFRAME);
RtTitle. Bottom=rtTitle. Top + GetSystemMetrics (SM_CYSIZE);

CPoint point;
//fill the top frame
Point. X=rtWnd. Width ();
Point. Y=GetSystemMetrics (SM_CYSIZE) + GetSystemMetrics (SM_CYFRAME) + 0;
PDC - & gt; PatBlt (0, 0, point x, point y, PATCOPY);
//fill left frame
Point x=GetSystemMetrics (SM_CXFRAME) - 1;
Point. Y=rtWnd. Height () - 1;
PDC - & gt; PatBlt (0, 0, point x, point y, PATCOPY);
//fill the bottom frame
Point. X=rtWnd. Width ();
Point. Y=GetSystemMetrics (SM_CYFRAME);
PDC - & gt; PatBlt (0, rtWnd Height () - point. Y, point, x, point. The y, PATCOPY);
//fill the right framework
Point x=GetSystemMetrics (SM_CXFRAME);
Point. Y=rtWnd. Height ();
PDC - & gt; PatBlt (rtWnd Width () - point. X, 0, point, x, point. The y, PATCOPY);

//drawing title bar icon
M_rtIcon. Left=rtTitle. Left;
M_rtIcon. Top=rtTitle. Top;
M_rtIcon. Right=m_rtIcon. Left + 16;
M_rtIcon. Bottom=m_rtIcon. Top + 15;
: : DrawIconEx (pDC - & gt; M_hDC, m_rtIcon left, m_rtIcon. Top AfxGetApp () - & gt; LoadIcon (IDR_MAINFRAME),
M_rtIcon. Width (), m_rtIcon. Height (), 0, NULL, DI_NORMAL);
M_rtIcon. OffsetRect (rtWnd TopLeft ());

CBitmap * pBitmap=new CBitmap;
CBitmap * pOldBitmap;
The CDC * pDisplayMemDC=new CDC;
PDisplayMemDC - & gt; CreateCompatibleDC (pDC);

//drawing close button
RtButtons. Left=rtTitle. Right - 16;
RtButtons. Top=rtTitle. Top - 1;
RtButtons. Right=rtButtons. Left + 16;
RtButtons. Bottom=rtButtons. Top + 15;
PBitmap - & gt; LoadBitmap (IDB_EXIT_FOCUS);
POldBitmap=(CBitmap *) pDisplayMemDC - & gt; SelectObject (pBitmap);
PDC - & gt; BitBlt (rtButtons rtButtons. Left, top, rtButtons. The Width (), rtButtons. Height (), pDisplayMemDC, 0, 0, SRCCOPY);
PDisplayMemDC - & gt; SelectObject (pOldBitmap);
M_rtButtExit=rtButtons;
M_rtButtExit. OffsetRect (rtWnd TopLeft ());
PBitmap - & gt; DeleteObject ();

Maximize//drawing/restore button
RtButtons. Right=rtButtons. Left - 3;
RtButtons. Left=rtButtons. Right - 16;
If (IsZoomed ())
{
PBitmap - & gt; LoadBitmap (IDB_RESTORE_NORMAL);
}
The else
PBitmap - & gt; LoadBitmap (IDB_MAX_NORMAL);
POldBitmap=(CBitmap *) pDisplayMemDC - & gt; SelectObject (pBitmap);
PDC - & gt; BitBlt (rtButtons rtButtons. Left, top, rtButtons. The Width (), rtButtons. Height (), pDisplayMemDC, 0, 0, SRCCOPY);
PDisplayMemDC - & gt; SelectObject (pOldBitmap);
M_rtButtMax=rtButtons;
M_rtButtMax. OffsetRect (rtWnd TopLeft ());
PBitmap - & gt; DeleteObject ();

//drawing to minimize button
RtButtons. Right=rtButtons. Left - 3;
RtButtons. Left=rtButtons. Right - 16;
PBitmap - & gt; LoadBitmap (IDB_MIN_NORMAL);
POldBitmap=(CBitmap *) pDisplayMemDC - & gt; SelectObject (pBitmap);
PDC - & gt; BitBlt (rtButtons rtButtons. Left, top, rtButtons. The Width (), rtButtons. Height (), pDisplayMemDC, 0, 0, SRCCOPY);
PDisplayMemDC - & gt; SelectObject (pOldBitmap);
M_rtButtMin=rtButtons;
M_rtButtMin. OffsetRect (rtWnd TopLeft ());
PBitmap - & gt; DeleteObject ();

//drawing caption
Int nOldMode=pDC - & gt; SetBkMode (TRANSPARENT);
COLORREF clOldText=pDC - & gt; SetTextColor (RGB (255255255));

CFont m_captionFont;
M_captionFont. CreateFont (
The height of 18,//font
The width of 0,//font
0,//the Angle of the font display
The Angle of the 0,//font
FW_BOLD,//font pounds
FALSE,//italic font
FALSE,//the font is underlined
0,//with a strikethrough font
ANSI_CHARSET,//the required character set
OUT_DEFAULT_PRECIS,//output accuracy
CLIP_DEFAULT_PRECIS,//cutting accuracy
DEFAULT_QUALITY,//logical font and font of the actual output equipment accuracy between
DEFAULT_PITCH | FF_SWISS,//font spacing and font sets
_T (" Arial "));//font name
CFont * pOldFont=NULL;
POldFont=pDC - & gt; SelectObject (& amp; M_captionFont);

RtTitle. Left +=m_rtIcon. Width () + 3;
RtTitle. Top=rtTitle. Top;
RtTitle. Bottom=rtTitle. Top + 30;
Cstrings m_strTitle;
GetWindowText (m_strTitle);
PDC - & gt; DrawText (m_strTitle, & amp; RtTitle DT_LEFT);
PDC - & gt; SetBkMode (nOldMode);
PDC - & gt; SetTextColor (clOldText);

The ReleaseDC (pDisplayMemDC);
nullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related