本文整理汇总了C++中Rect::CenterRect方法的典型用法代码示例。如果您正苦于以下问题:C++ Rect::CenterRect方法的具体用法?C++ Rect::CenterRect怎么用?C++ Rect::CenterRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rect
的用法示例。
在下文中一共展示了Rect::CenterRect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetupRect
void TopWindow::SetupRect(Ctrl *owner)
{
Rect r = GetRect();
if(r.IsEmpty())
SetRect(GetDefaultWindowRect());
else
if(r.left == 0 && r.top == 0 && center == 1) {
Rect area = owner ? owner->GetWorkArea() : Ctrl::GetWorkArea();
SetRect(area.CenterRect(min(area.Size(), r.Size())));
}
}
示例2: OpenHelp
void HelpWin::OpenHelp(const String& topic) {
if(!IsTreeEnabled()) ClearTree();
if(!IsOpen()) {
Rect r = Ctrl::GetWorkArea();
Size s = r.Size();
r = r.CenterRect(s/2);
SetRect(r);
OpenMain();
}
else SetForeground();
GoTo("topic://" + GetExeTitle() + "/" + topic);
EnableTree(false);
return;
}
示例3: Find
void RichEdit::Find()
{
CancelSelection();
FindReplaceAddHistory();
if(notfoundfw)
Move(0, false);
found = notfoundfw = false;
int pos = FindPos();
if(pos >= 0) {
anchor = pos;
cursor = pos + findreplace.find.GetText().GetLength();
Finish();
found = true;
Size sz = findreplace.GetSize();
Rect sw = GetScreenView();
Rect r = sw.CenterRect(sz);
Rect cr = GetCaretRect();
if(cr.top < sz.cy + 2 * cr.Height()) {
r.bottom = sw.bottom - 8;
r.top = r.bottom - sz.cy;
}
else {
r.top = sw.top + 24;
r.bottom = r.top + sz.cy;
}
findreplace.SetRect(r);
if(!findreplace.IsOpen()) {
findreplace.Open();
}
SetFocus();
}
else {
CancelSelection();
CloseFindReplace();
notfoundfw = true;
}
}