本文整理汇总了C++中Rect::BottomCenter方法的典型用法代码示例。如果您正苦于以下问题:C++ Rect::BottomCenter方法的具体用法?C++ Rect::BottomCenter怎么用?C++ Rect::BottomCenter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rect
的用法示例。
在下文中一共展示了Rect::BottomCenter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawGroupTools
void FormView::DrawGroupTools(Draw& w, const Rect& r)
{
if (!IsLayout())
return;
_groupRect = r;
Point p;
Rect t;
int v;
p = r.TopLeft();
v = (r.BottomLeft().y >= GetRect().Height())
? GetRect().Height() - (GetRect().Height() - r.TopLeft().y) / 2 - 10
: ((r.TopLeft().y < 0)
? r.BottomLeft().y / 2 - 10
: r.CenterLeft().y - 10);
if (p.x >= 20) // left tool
{
t = Rect(Point(r.CenterLeft().x - 10, v), Size(11, 11) );
w.DrawImage(t, _toolLeft[_leftCur]);
}
else
{
t = Rect(Point(2, v), Size(11, 11) );
w.DrawImage(t, _toolLeft[_leftCur]);
}
v = (r.TopLeft().x < 0)
? r.TopRight().x / 2 - 5
: (r.TopRight().x > GetRect().Width()
? GetRect().Width() - (GetRect().Width() - r.TopLeft().x) / 2 - 5
: r.TopCenter().x - 5);
if (p.y >= 20)
{
t = Rect( Point(v, r.TopCenter().y - 10), Size(11, 11) ); // top tool
w.DrawImage(t, _toolTop[_topCur]);
}
else
{
t = Rect( Point(v, 2), Size(11, 11) ); // top tool
w.DrawImage(t, _toolTop[_topCur]);
}
p = r.BottomRight();
v = (p.y >= GetRect().Height())
? GetRect().Height() - (GetRect().Height() - r.TopLeft().y) / 2 - 10
: ((r.TopLeft().y < 0)
? r.BottomLeft().y / 2 - 110
: r.CenterLeft().y - 10);
if (p.x <= GetRect().Width() - 20)
{
t = Rect( Point(r.CenterRight().x, v), Size(11, 11) ); // right tool
w.DrawImage(t, _toolRight[_rightCur]);
}
else
{
t = Rect( Point(GetRect().Width() - 11, v), Size(11, 11) ); // right tool
w.DrawImage(t, _toolRight[_rightCur]);
}
v = (r.TopLeft().x < 0)
? r.TopRight().x / 2 - 5
: (r.TopRight().x > GetRect().Width()
? GetRect().Width() - (GetRect().Width() - r.TopLeft().x) / 2 - 5
: r.TopCenter().x - 5);
if (p.y <= GetRect().Height() - 20)
{
t = Rect( Point(v, r.BottomCenter().y), Size(11, 11) ); // bottom tool
w.DrawImage(t, _toolBottom[_bottomCur]);
}
else
{
t = Rect( Point(v, GetRect().Height() - 11), Size(11, 11) ); // bottom tool
w.DrawImage(t, _toolBottom[_bottomCur]);
}
}
示例2: DrawObject
void FormView::DrawObject(Draw& w, int id, const Color& c, bool springs)
{
if (!IsLayout())
return;
FormObject *pI = GetObject(id);
if (!pI) return;
Rect offseted = Offseted(pI->GetRect());
offseted = Zoom(offseted);
if (_showInfo == 2)
w.DrawRect(offseted, c);
String type = pI->Get("Type");
if (type == "Label")
DrawRect(w, offseted.Offseted(-1, 0), 1, LtGray());
if (pI->IsSelected() && springs)
{
DrawSprings(w, offseted, pI->GetHAlign(), pI->GetVAlign());
w.DrawImage(offseted.right, offseted.bottom, FormViewImg::SizerBR());
DrawRect(w, offseted, 1, LtRed());
}
else if (pI->IsSelected() && !springs)
DrawRect(w, Point(offseted.left, offseted.top),
Size(offseted.Width(), offseted.Height()), 1, LtRed());
else if (_showInfo == 2 || pI->GetBool("OutlineDraw"))
DrawRect(w, offseted, 1, Black());
if (pI->GetBool("OutlineDraw"))
{
Rect l = offseted.Offseted( ZoomX(3), ZoomY(3) );
l = Rect( l.TopLeft(), l.GetSize() - Size(ZoomX(6), ZoomY(6)) );
DrawRect(w, l, 1, LtCyan());
}
String temp = pI->Get("Variable");
Size t = GetTextSize( temp, _Font );
int cx = t.cx;
int y = offseted.BottomCenter().y - t.cy - ZoomY(3);
if (_showInfo > 0)
{
if (offseted.Width() > t.cx + 15)
{
int x1 = ZoomX(pI->GetRect().right) - DeZoomX(2) - 4 - t.cx + ZoomX(X(0));
w.DrawRect( x1 - 2, y, t.cx + 3, t.cy, White());
// DrawRect(w, Point(x1 - 2, y), Size(t.cx + 3, t.cy), 1, LtGray());
w.DrawText( x1, y, temp, _Font, LtBlue);
}
temp = AsString(id) + " " + type;
t = GetTextSize(temp, _Font);
Size s = GetTextSize(AsString(id), _Font);
if (offseted.Width() - cx > t.cx + 10)
{
w.DrawRect( offseted.left + ZoomX(5) - 2, y, t.cx + 3, t.cy, White());
// DrawRect(w, Point(offseted.left + ZoomX(5) - 2, y), Size(t.cx + 3, t.cy),
// 1, LtGray());
w.DrawText( offseted.left + ZoomX(5), y, temp, _Font, Gray());
}
else if (offseted.Width() > s.cx + 5)
{
w.DrawRect( offseted.left + ZoomX(5) - 2, y, s.cx + 3, s.cy, White());
// DrawRect(w, Point(offseted.left + ZoomX(5) - 2, y), Size(s.cx + 3, s.cy),
// 1, LtGray());
w.DrawText( offseted.left + ZoomX(5), y, AsString(id), _Font, Gray());
}
}
}