コード例 #1
0
ファイル: Separator.cpp プロジェクト: strogo/AppRunner
void CSeparator::DrawTextImpl(CPaintDC &dc, CString text, CRect clientRect)
{
   auto &g = Globals::Instance();

   HFONT hOldFont = dc.SelectFont(g.sep.font);

   dc.SetTextColor(g.sep.textColor);
   dc.SetBkColor(g.bkColor);

   const int margin = 0;
   CSize textSize;
   dc.GetTextExtent(text, -1, &textSize);
   CRect textRect(clientRect);
   textRect.left = margin;
   textRect.right = textRect.left + textSize.cx + 2 * 3;
   dc.FillSolidRect(textRect, g.bkColor);
   textRect.InflateRect(-3, 0);
   dc.DrawText(text, -1, textRect, DT_VCENTER | DT_CENTER | DT_SINGLELINE);

   dc.SelectFont(hOldFont);
}
コード例 #2
0
void PreviousImagesView::DrawEmptyView(CPaintDC& dc)
{
   DWORD dwColor = ::GetSysColor(COLOR_APPWORKSPACE);
   dc.FillSolidRect(&dc.m_ps.rcPaint, dwColor);

   // output "no image" string
   CRect rcClient;
   GetClientRect(&rcClient);

   HFONT oldFont = dc.SelectFont(GetFont());

   dc.SetBkColor(dwColor);
   dc.SetTextColor(GetSysColor(COLOR_WINDOWTEXT));

   CString cszText = m_manager.ImagesAvail() ? _T("<Loading image...>") : _T("<No images available>");

   // add DT_SINGLELINE to center both vertically and horizontally
   dc.DrawText(cszText, cszText.GetLength(), rcClient, DT_CENTER | DT_VCENTER | DT_SINGLELINE);

   dc.SelectFont(oldFont);
}
コード例 #3
0
void PreviousImagesView::DrawImageInfos(CPaintDC& dc, int iWidth)
{
   std::shared_ptr<PreviousImageInfo> spCurrentImage = m_spCurrentImage;

   if (spCurrentImage == nullptr)
      return;

   CRect rcPaint;
   GetClientRect(&rcPaint);
   rcPaint.left = iWidth + c_uiPaddingImageInfo;
   rcPaint.top += c_uiPaddingImageInfo;

   HFONT oldFont = dc.SelectFont(GetFont());

   dc.SetBkMode(TRANSPARENT);
   dc.SetTextColor(GetSysColor(COLOR_WINDOWTEXT));

   CString cszText;
   cszText.Format(
      _T("Filename: %s\n")
      _T("Av: %s\n")
      _T("Tv: %s\n")
      _T("ISO: %s\n")
      _T("Zoom: %s\n")
      _T("Date: %s\n")
      _T("%s"),
      spCurrentImage->Filename().GetString(),
      spCurrentImage->InfoText(PreviousImageInfo::typeAperture).GetString(),
      spCurrentImage->InfoText(PreviousImageInfo::typeShutterSpeed).GetString(),
      spCurrentImage->InfoText(PreviousImageInfo::typeIsoSetting).GetString(),
      spCurrentImage->InfoText(PreviousImageInfo::typeFocalLength).GetString(),
      spCurrentImage->InfoText(PreviousImageInfo::typeDateTime).GetString(),
      spCurrentImage->InfoText(PreviousImageInfo::typeFlashFired).GetString());

   dc.DrawText(cszText, cszText.GetLength(), rcPaint, DT_LEFT | DT_TOP);

   dc.SelectFont(oldFont);
}