OSDN Git Service

FilepathEdit.cpp: Fix that text on the header bar disappears when mouse pointer hover...
authorsdottaka <sdottaka@users.sourceforge.net>
Sun, 18 Oct 2015 13:55:59 +0000 (22:55 +0900)
committersdottaka <sdottaka@users.sourceforge.net>
Sun, 18 Oct 2015 13:55:59 +0000 (22:55 +0900)
Src/FilepathEdit.cpp

index fbcd3f3..617a2a4 100644 (file)
@@ -301,13 +301,27 @@ void CFilepathEdit::OnContextMenu(CWnd*, CPoint point)
        }
 }
 
+static COLORREF GetDarkenColor(COLORREF a, double r)
+{
+       const int R = GetRValue(a) * r;
+       const int G = GetGValue(a) * r;
+       const int B = GetBValue(a) * r;
+       return RGB(R, G, B);
+}
+
 void CFilepathEdit::OnNcPaint()
 {
        CWindowDC dc(this);
        CRect rect;
+       const int margin = 4;
        GetWindowRect(rect);
        rect.OffsetRect(-rect.TopLeft());
-       dc.FillSolidRect(rect, m_crBackGnd);
+       dc.FillSolidRect(CRect(rect.left, rect.top, rect.left + margin, rect.bottom), GetDarkenColor(m_crBackGnd, 0.98));
+       dc.FillSolidRect(CRect(rect.left, rect.top, rect.left + 1, rect.bottom), GetDarkenColor(m_crBackGnd, 0.90));
+       dc.FillSolidRect(CRect(rect.right - margin, rect.top, rect.right, rect.bottom), m_crBackGnd);
+       dc.FillSolidRect(CRect(rect.left + 1, rect.top, rect.right, rect.top + margin), GetDarkenColor(m_crBackGnd, 0.98));
+       dc.FillSolidRect(CRect(rect.left, rect.top, rect.right, rect.top + 1), GetDarkenColor(m_crBackGnd, 0.90));
+       dc.FillSolidRect(CRect(rect.left + margin, rect.bottom - margin, rect.right, rect.bottom), m_crBackGnd);
 }
 
 /**