本文整理汇总了C++中WndForm::resize方法的典型用法代码示例。如果您正苦于以下问题:C++ WndForm::resize方法的具体用法?C++ WndForm::resize怎么用?C++ WndForm::resize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WndForm
的用法示例。
在下文中一共展示了WndForm::resize方法的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) {
//.........这里部分代码省略.........