@@ -286,20 +286,30 @@ void CFilepathEdit::OnNcPaint()
286
286
dc.FillSolidRect (CRect (rect.left + margin, rect.bottom - margin, rect.right , rect.bottom ), m_crBackGnd);
287
287
}
288
288
289
+ static float PointToPixel (CDC& dc, float pt)
290
+ {
291
+ const int lpx = dc.GetDeviceCaps (LOGPIXELSX);
292
+ return pt * lpx / 72 .0f ;
293
+ }
294
+
289
295
void CFilepathEdit::OnPaint ()
290
296
{
291
297
__super::OnPaint ();
292
298
if (!m_bInEditing)
293
299
{
294
300
CClientDC dc (this );
295
- CFont *pFontOld = dc.SelectObject (GetFont ());
296
- int oldTextColor = dc.SetTextColor (m_crText);
297
- int oldBkMode = dc.SetBkMode (TRANSPARENT);
301
+ Gdiplus::Graphics graphics (dc);
302
+ graphics.SetSmoothingMode (Gdiplus::SmoothingModeAntiAlias);
298
303
CRect rc = GetMenuCharRect (&dc);
299
- dc.TextOutW (rc.left , 0 , IsWin7_OrGreater () ? _T (" \u2261 " ) : _T (" =" ));
300
- dc.SetBkMode (oldBkMode);
301
- dc.SetTextColor (oldTextColor);
302
- dc.SelectObject (pFontOld);
304
+ Gdiplus::Pen pen (Gdiplus::Color (255 , GetRValue (m_crText), GetGValue (m_crText), GetBValue (m_crText)), PointToPixel (dc, 0 .75f ));
305
+ const int lineCount = 3 ;
306
+ const float spacing = PointToPixel (dc, 2 .25f );
307
+ const int padding = static_cast <int >(PointToPixel (dc, 0 .75f ));
308
+ for (int i = 0 ; i < lineCount; ++i)
309
+ {
310
+ float y = rc.top + (rc.Height () - (lineCount - 1 ) * spacing) / 2 + i * spacing;
311
+ graphics.DrawLine (&pen, static_cast <float >(rc.left + padding), y, static_cast <float >(rc.right - padding), y);
312
+ }
303
313
}
304
314
}
305
315
@@ -321,8 +331,7 @@ CRect CFilepathEdit::GetMenuCharRect(CDC* pDC)
321
331
{
322
332
CRect rc;
323
333
GetClientRect (rc);
324
- int charWidth;
325
- pDC->GetCharWidth (' =' , ' =' , &charWidth);
334
+ int charWidth = static_cast <int >(PointToPixel (*pDC, 6 .0f ));
326
335
rc.left = rc.right - charWidth;
327
336
return rc;
328
337
}
0 commit comments