当前位置: 首页>>代码示例>>C++>>正文


C++ WndForm::SetTitleFont方法代码示例

本文整理汇总了C++中WndForm::SetTitleFont方法的典型用法代码示例。如果您正苦于以下问题:C++ WndForm::SetTitleFont方法的具体用法?C++ WndForm::SetTitleFont怎么用?C++ WndForm::SetTitleFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WndForm的用法示例。


在下文中一共展示了WndForm::SetTitleFont方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: WndButton

/**
 * Displays a MessageBox and returns the pressed button
 * @param lpText Text displayed inside the MessageBox
 * @param lpCaption Text displayed in the Caption of the MessageBox
 * @param uType Type of MessageBox to display (OK+Cancel, Yes+No, etc.)
 * @return
 */
int WINAPI
MessageBoxX(LPCTSTR lpText, LPCTSTR lpCaption, UINT uType)
{
  WndForm *wf = NULL;
  WndFrame *wText = NULL;
  int X, Y, Width, Height;
  WndButton *wButtons[10];
  int ButtonCount = 0;
  int i, x, y, d, w, h, res, dY;
  RECT rc;

  assert(lpText != NULL);
  assert(lpCaption != NULL);

  // JMW this makes the first key if pressed quickly, ignored
  // TODO bug: doesn't work sometimes. buttons have to be pressed multiple times (TB)
  XCSoarInterface::Debounce();

  rc = XCSoarInterface::main_window.get_screen_position();

#ifdef ALTAIRSYNC
  Width = Layout::Scale(220);
  Height = Layout::Scale(160);
#else
  Width = Layout::Scale(200);
  Height = Layout::Scale(160);
#endif

  X = ((rc.right - rc.left) - Width) / 2;
  Y = ((rc.bottom - rc.top) - Height) / 2;

  y = Layout::Scale(100);
  w = Layout::Scale(60);
  h = Layout::Scale(32);

  // Create dialog
  wf = new WndForm(&XCSoarInterface::main_window, _T("frmXcSoarMessageDlg"),
                   lpCaption, X, Y, Width, Height);
  wf->SetFont(MapWindowBoldFont);
  wf->SetTitleFont(MapWindowBoldFont);
  wf->SetBackColor(Color(0xDA, 0xDB, 0xAB));

  // Create text element
  wText = new WndFrame(wf, _T("frmMessageDlgText"),
                       0, Layout::Scale(5), Width, Height);

  wText->SetCaption(lpText);
  wText->SetFont(MapWindowBoldFont);
  wText->SetCaptionStyle(DT_EXPANDTABS | DT_CENTER | DT_NOCLIP | DT_WORDBREAK);
  // | DT_VCENTER

  /* TODO code: this doesnt work to set font height
  dY = wText->GetLastDrawTextHeight() - Height;
  */
  dY = Layout::Scale(-40);
  wText->resize(Width, wText->GetTextHeight() + 5);
  wf->resize(Width, wf->get_size().cy + dY);

  y += dY;

  // Create buttons
  uType = uType & 0x000f;
  if (uType == MB_OK || uType == MB_OKCANCEL) {
    wButtons[ButtonCount] =
        new WndButton(wf, _T(""), gettext(_T("OK")), 0, y, w, h, OnButtonClick);

    wButtons[ButtonCount]->SetTag(IDOK);
    ButtonCount++;
  }

  if (uType == MB_YESNO || uType == MB_YESNOCANCEL) {
    wButtons[ButtonCount] =
        new WndButton(wf, _T(""), gettext(_T("Yes")), 0, y, w, h, OnButtonClick);

    wButtons[ButtonCount]->SetTag(IDYES);
    ButtonCount++;

    wButtons[ButtonCount] =
        new WndButton(wf, _T(""), gettext(_T("No")), 0, y, w, h, OnButtonClick);

    wButtons[ButtonCount]->SetTag(IDNO);
    ButtonCount++;
  }

  if (uType == MB_ABORTRETRYIGNORE || uType == MB_RETRYCANCEL) {
    wButtons[ButtonCount] =
        new WndButton(wf, _T(""), gettext(_T("Retry")), 0, y, w, h, OnButtonClick);

    wButtons[ButtonCount]->SetTag(IDRETRY);
    ButtonCount++;
  }

  if (uType == MB_OKCANCEL || uType == MB_RETRYCANCEL || uType == MB_YESNOCANCEL) {
//.........这里部分代码省略.........
开发者ID:bugburner,项目名称:xcsoar,代码行数:101,代码来源:Message.cpp


注:本文中的WndForm::SetTitleFont方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。