本文整理汇总了C++中Draw::DrawRect方法的典型用法代码示例。如果您正苦于以下问题:C++ Draw::DrawRect方法的具体用法?C++ Draw::DrawRect怎么用?C++ Draw::DrawRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Draw
的用法示例。
在下文中一共展示了Draw::DrawRect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Paint
void MyList::Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const {
if(style & CURSOR)
w.DrawRect(r,SLtGray());
else
w.DrawRect(r,SWhite());
w.DrawText(r.left,r.top,q.ToString());
}
示例2: Paint
void MyApp::Paint(Draw& w)
{
w.DrawRect(GetSize(), SColorPaper());
w.DrawText(pos.x, pos.y, data.text, StdFont(), data.color);
if(!IsNull(dragpos))
w.DrawRect(RectC(dragpos.x - 1, dragpos.y - 1, 3, 3), LtBlue);
}
示例3: Paint
void RGBACtrl::Paint(Draw& w)
{
w.DrawRect(GetSize(), SColorFace);
if(alpha.IsMask())
return;
for(int x = 0; x <= 18; x++)
w.DrawRect(x * cbox.cx + cs.x, cs.y, 1, cbox.cy * 14, SColorText());
int i = 0;
int my = cs.y + 1;
w.DrawRect(cs.x, cs.y + 14 * cbox.cy, cbox.cx * 18 + 1, 1, SColorText());
Point pp = Null;
for(int y = 0; y < 14; y++) {
w.DrawRect(cs.x, my - 1, cbox.cx * 18 + 1, 1, SColorText());
int mx = cs.x + 1;
for(int x = 0; x < 18; x++) {
Color c = GetColor(i++);
w.DrawRect(mx, my, cbox.cx - 1, cbox.cy - 1, c);
if(c == color)
pp = Point(mx, my);
mx += cbox.cx;
}
my += cbox.cy;
}
if(!IsNull(pp)) {
Size isz = CtrlImg::wheel_cursor().GetSize();
pp = pp + (cbox - isz) / 2;
w.DrawImage(pp.x, pp.y, CtrlImg::wheel_cursor(),
Grayscale(color) < 120 ? White() : Black());
}
}
示例4: Paint
void ValueSlider::Paint(Draw &w)
{
Size sz = GetSize();
/*w.DrawRect(0, 0, sz.cx, 1, Black);
w.DrawRect(0, sz.cy - 1, sz.cx, 1, Black);
w.DrawRect(0, 0, 1, sz.cy, Black);
w.DrawRect(sz.cx - 1, 0, 1, sz.cy, Black);*/
int t = (int) (((pos - minValue) * sz.cx) / (maxValue - minValue));
if(t < 1) t = 1;
if(t > sz.cx - 1) t = sz.cx - 1;
if(shaded)
{
for(int i = 1; i < t; i++)
w.DrawRect(i, 1, 1, sz.cy - 2, Blend(src, dst, 256 * i / (sz.cx - 1)));
}
else
{
w.DrawRect(Rect(1, 1, t, sz.cy - 1), dst);
}
if(t < sz.cx - 1)
w.DrawRect(Rect(t, 1, sz.cx - 1, sz.cy - 1), Color(245, 245, 255));
String s = Format("%s : %.2f", text, pos);
Size tsz = GetTextSize(s, StdFont());
w.DrawText((sz.cx - tsz.cx) / 2, (sz.cy - tsz.cy) / 2, s);
}
示例5: DrawHorzDrop
void DrawHorzDrop(Draw& w, int x, int y, int cx)
{
w.DrawRect(x, y, cx, 2, SColorHighlight);
w.DrawRect(x, y - 2, 1, 6, SColorHighlight);
w.DrawRect(x + cx - 1, y - 2, 1, 6, SColorHighlight);
w.DrawRect(x + 1, y - 1, 1, 4, SColorHighlight);
w.DrawRect(x + cx - 2, y - 1, 1, 4, SColorHighlight);
}
示例6: DrawVertDrop
void DrawVertDrop(Draw& w, int x, int y, int cy)
{
w.DrawRect(x, y, 2, cy, SColorHighlight);
w.DrawRect(x - 2, y, 6, 1, SColorHighlight);
w.DrawRect(x - 2, y + cy - 1, 6, 1, SColorHighlight);
w.DrawRect(x - 1, y + 1, 4, 1, SColorHighlight);
w.DrawRect(x - 1, y + cy - 2, 4, 1, SColorHighlight);
}
示例7: Paint
void ItemProperty::Paint(Draw& w)
{
Size sz = GetSize();
w.DrawRect(sz, SColorLtFace);
w.DrawRect(0, GetHeight() - 1, sz.cx, 1, SColorText);
w.DrawText(2,
(EditField::GetStdHeight() + 6 - GetTextSize(name, StdFont()).cy) / 2, name,
GetData() == defval ? StdFont()() : StdFont().Bold());
}
示例8: Paint
void DocEdit::Paint(Draw& w) {
Size sz = GetSize();
Color bg = color[IsShowEnabled() && !IsReadOnly() ? PAPER_NORMAL : PAPER_READONLY];
if(nobg)
bg = Null;
int y = -sb + 1;
int pos = 0;
int sell, selh;
GetSelection(sell, selh);
for(int i = 0; i < para.GetCount() && y < sz.cy; i++) {
int h = GetHeight(i);
if(y + h >= 0) {
WString text = line[i];
Fmt fmt = Format(text);
int p = pos;
for(int i = 0; i < fmt.line.GetCount(); i++) {
int n = fmt.LineEnd(i) - fmt.line[i];
int a = minmax(sell - p, 0, n);
int b = minmax(selh - p, 0, n) - a;
int c = n - a - b;
int *wa = fmt.width + fmt.line[i];
int *wb = fmt.width + fmt.line[i] + a;
int *wc = fmt.width + fmt.line[i] + a + b;
int acx = sSum(wa, a);
int bcx = sSum(wb, b);
int ccx = sSum(wc, c);
w.DrawRect(1, y, acx, fmt.fi.GetHeight(), bg);
w.DrawText(1, y, ~fmt.text + fmt.line[i], font,
IsShowEnabled() ? color[INK_NORMAL] : color[INK_DISABLED], a, wa);
w.DrawRect(1 + acx, y, bcx, fmt.fi.GetHeight(), color[PAPER_SELECTED]);
w.DrawText(1 + acx, y, ~fmt.text + fmt.line[i] + a, font, color[INK_SELECTED], b, wb);
w.DrawRect(1 + acx + bcx, y, ccx, fmt.fi.GetHeight(), bg);
w.DrawText(1 + acx + bcx, y, ~fmt.text + fmt.line[i] + a + b, font, color[INK_NORMAL], c, wc);
p += n;
w.DrawRect(1 + acx + bcx + ccx, y, cx - (acx + bcx + ccx), fmt.fi.GetHeight(),
p >= sell && p < selh ? color[PAPER_SELECTED] : bg);
y += fmt.fi.GetHeight();
}
w.DrawRect(1, y, cx, after, color[PAPER_NORMAL]);
y += after;
}
else
y += h;
pos += line[i].GetLength() + 1;
}
w.DrawRect(0, -sb, sz.cx, 1, bg);
w.DrawRect(0, 0, 1, sz.cy, bg);
w.DrawRect(sz.cx - 1, 0, 1, sz.cy, bg);
if(eofline)
w.DrawRect(1, y++, cx, 1, SColorShadow);
if(y < sz.cy)
w.DrawRect(1, y, cx, sz.cy - y, bg);
DrawTiles(w, DropCaret(), CtrlImg::checkers());
}
示例9: Blend
void Navigator::NavigatorDisplay::PaintBackground(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const
{
int ii = q;
if(ii < 0 || ii >= item.GetCount())
return;
const NavItem& m = *item[ii];
bool focuscursor = (style & (FOCUS|CURSOR)) == (FOCUS|CURSOR) || (style & SELECT);
if(findarg(m.kind, KIND_FILE, KIND_NEST) >= 0)
w.DrawRect(r, focuscursor ? paper : m.kind == KIND_NEST ? Blend(SColorMark, SColorPaper, 220)
: SColorFace);
else
w.DrawRect(r, paper);
}
示例10: PaintFileName
int Navigator::NavigatorDisplay::DoPaint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const
{
int ii = q;
if(ii < 0 || ii >= item.GetCount())
return 0;
const NavItem& m = *item[ii];
bool focuscursor = (style & (FOCUS|CURSOR)) == (FOCUS|CURSOR) || (style & SELECT);
int x = r.left;
int ry = r.top + r.GetHeight() / 2;
int y = ry - Draw::GetStdFontCy() / 2;
if(findarg(m.kind, KIND_FILE, KIND_NEST) >= 0) {
w.DrawRect(r, focuscursor ? paper : m.kind == KIND_NEST ? Blend(SColorMark, SColorPaper, 220)
: SColorFace);
if(m.kind == KIND_FILE)
return PaintFileName(w, r, m.type, ink);
String h = FormatNest(m.type);
w.DrawText(x, y, h, StdFont().Bold(), ink);
return GetTextSize(h, StdFont().Bold()).cx;
}
w.DrawRect(r, paper);
if(m.kind == KIND_LINE) {
w.DrawText(x, y, m.type, StdFont().Bold(), ink);
return GetTextSize(m.type, StdFont().Bold()).cx;
}
PaintCppItemImage(w, x, ry, m.access, m.kind, focuscursor);
x += Zx(15);
Vector<ItemTextPart> n = ParseItemNatural(m.name, m.natural, m.ptype, m.pname, m.type,
m.tname, m.ctname, ~m.natural + m.at);
int starti = 0;
for(int i = 0; i < n.GetCount(); i++)
if(n[i].type == ITEM_NAME) {
starti = i;
break;
}
PaintText(w, x, y, m.natural, n, starti, n.GetCount(), focuscursor, ink, false);
if(starti) {
const char *h = " : ";
w.DrawText(x, y, h, BrowserFont(), SColorText);
x += GetTextSize(h, BrowserFont()).cx;
}
PaintText(w, x, y, m.natural, n, 0, starti, focuscursor, ink, false);
return x;
}
示例11: Paint
void PopUpInfo::Paint(Draw& w)
{
Size sz = GetSize();
if(!IsTransparent())
w.DrawRect(0, 0, sz.cx, sz.cy, color);
PaintLabel(w, 0, 0, sz.cx, sz.cy, !IsShowEnabled(), false, false, VisibleAccessKeys());
}
示例12: FramePaint
// frame painting
void XMLDragFrame::FramePaint(Draw& w, const Rect& r)
{
w.DrawRect(r, SColorFace());
int x1 = r.left + 1;
int x2 = r.right - 1;
int y1 = r.top + 1;
int y2 = r.bottom -1;
w.DrawLine(x1, y1, x2, y1, 1, SColorLight());
w.DrawLine(x2, y1, x2, y2, 1, SColorShadow());
w.DrawLine(x2, y2, x1, y2, 1, SColorShadow());
w.DrawLine(x1, y2, x1, y1, 1, SColorLight());
if(align == ToolBar::BAR_LEFT || align == ToolBar::BAR_RIGHT)
{
x1 = r.left + 5;
x2 = r.right - 5;
y1 = r.top + 4;
y2 = r.top + 9;
w.DrawLine(x1, y1, x2, y1, 2, SColorShadow());
w.DrawLine(x1, y2, x2, y2, 2, SColorShadow());
}
else
{
x1 = r.left + 4;
x2 = r.left + 9;
y1 = r.top + 5;
y2 = r.bottom - 5;
w.DrawLine(x1, y1, x1, y2, 2, SColorShadow());
w.DrawLine(x2, y1, x2, y2, 2, SColorShadow());
}
}
示例13: Paint
///////////////////////////////////////////////////////////////////////////////////////////////
// paint routine
void PixRasterBaseCtrl::Paint(Draw &d)
{
// clears background
d.DrawRect(GetSize(), SColorFace());
// if no associated PixRaster, does nothing
if(!pixRasterCtrl->GetPixBase())
return;
// paints image inside cache, if needed
PaintCache();
// paints image cache inside control
if(imageCache.GetWidth() >= GetSize().cx)
imageCache.Paint(d, Point(0, 0));
else
imageCache.Paint(d, Point((GetSize().cx - imageCache.GetWidth()) / 2, 0));
// paints markers inside control
PaintMarkers(d);
// if dragging, paints rubber banded polygon
if(selectedMarker && dragPolygon.GetCount())
{
d.DrawPolygon(dragPolygon, dragPolygon.GetCount(),
selectedMarker->GetFillColor(),
selectedMarker->GetBorderThickness(),
selectedMarker->GetBorderColor(),
PEN_DOT,
White);
}
} // END LeptonicaBaseCtrl::Paint()
示例14: DrawImageBandRLE
void DrawImageBandRLE(Draw& w, int x, int y, const Image& m, int minp)
{
int xi = 0;
int cx = m.GetWidth();
int ccy = m.GetHeight();
Buffer<bool> todo(cx, true);
#ifdef BENCHMARK_RLE
sTotal += cx;
#endif
while(xi < cx) {
int xi0 = xi;
while(w.Dots() && IsWhiteColumn(m, xi) && xi < cx)
xi++;
if(xi - xi0 >= 16) {
#ifdef BENCHMARK_RLE
sRle += xi - xi0;
#endif
w.DrawRect(x + xi0, y, xi - xi0, ccy, White);
Fill(~todo + xi0, ~todo + xi, false);
}
xi++;
}
xi = 0;
while(xi < cx)
if(todo[xi]) {
int xi0 = xi;
while(xi < cx && todo[xi] && xi - xi0 < 2000)
xi++;
w.DrawImage(x + xi0, y, m, RectC(xi0, 0, xi - xi0, ccy));
}
else
xi++;
}
示例15: Paint
virtual void Paint(Draw& w)
{
Size sz = GetSize();
w.DrawRect(sz, LtGray);
w.DrawRect(sz / 2, LtBlue);
w.DrawText(10, 10, "Hello", Arial(12));
w.DrawImage(50, 50, CtrlImg::exclamation());
w.DrawImage(100, 50, CtrlImg::exclamation(), Blue);
w.DrawImage(50, 150, CtrlsImg::O1h());
w.DrawImage(150, 150, CtrlsImg::O1h());
w.Clipoff(50, 180, 40, 40);
w.DrawImage(0, 0, 50, 50, CtrlsImg::O1h());
w.End();
w.DrawImage(100, 100, ball);
w.DrawImage(200, 200, 40, 40, ball);
}