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


C++ Draw::DrawText方法代码示例

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


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

示例1: DrawTextEllipsis

NAMESPACE_UPP

void DrawTextEllipsis(Draw& w, int x, int y, int cx, const wchar *text, const char *ellipsis,
                      Font font, Color ink, int n)
{
    if(n < 0) n = wstrlen(text);
    FontInfo f = font.Info();
    const char *s;
    int dtl = 0;
    int el = 0;
    for(s = ellipsis; *s; s++) {
        dtl += f[(byte)*s];
        el++;
    }
    int l = 0;
    int i;
    for(i = 0; i < n; i++) {
        l += f[(byte) text[i]];
        if(l > cx) {
            while(l + dtl > cx && i > 0) {
                l -= f[(byte) text[i]];
                i--;
            }
            i++;
            break;
        }
    }
    w.DrawText(x, y, text, font, ink, i);
    if(i < n)
        w.DrawText(x + l, y, ellipsis, font, ink, el);
}
开发者ID:pedia,项目名称:raidget,代码行数:31,代码来源:DrawTextUtil.cpp

示例2: Paint

    virtual void Paint(Draw& w) {
        w.DrawRect(GetSize(), White);
        w.DrawText(10, 10, "ultimate++是一个性能优良的C++GUI库");
        w.DrawText(10, 100, "X\357\274\214X");
        WString h("x\357\274\214X");
        w.DrawText(10, 150, h);
        DDUMP(h.GetLength());
    }
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:8,代码来源:main.cpp

示例3: Paint

void MyApp::Paint(Draw& w)
{
    w.DrawRect(GetSize(), SColorPaper());
    for(int i = 0; i < MyImages::GetCount(); i++) {
        w.DrawImage(50, 80 + 20 * i, MyImages::Get(i));
        w.DrawText(80, 80 + 20 * i, MyImages::GetId(i));
    }
    w.DrawImage(20, 0, 50, 50, MyImages::Get(MyImages::I_Circle));
    w.DrawText(80, 0, AsString(MyImages::Find("Circle")));
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:10,代码来源:main.cpp

示例4: 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());
}
开发者ID:guowei8412,项目名称:upp-mirror,代码行数:54,代码来源:DocEdit.cpp

示例5: Paint

void MyApp::Paint(Draw& w)
{
    w.DrawRect(GetSize(), White());

    Font fnt = StdFont(10);
    w.DrawText(100, 200, "Quick brown 1234567890", fnt);
    w.DrawText(100, 200, 900, "Quick brown 1234567890", fnt);

    fnt = Arial(10);
    w.DrawText(300, 200, "Quick brown 1234567890", fnt);
    w.DrawText(300, 200, 900, "Quick brown 1234567890", fnt);
}
开发者ID:ultimatepp,项目名称:mirror,代码行数:12,代码来源:main.cpp

示例6: 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;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:48,代码来源:Navigator.cpp

示例7: 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);
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:30,代码来源:ControlPanel.cpp

示例8: 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);
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:7,代码来源:main.cpp

示例9: GetTextSize

int Navigator::ScopeDisplay::DoPaint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const
{
    w.DrawRect(r, paper);
    if(IsNull(q)) {
        const char *txt = "All";
        w.DrawText(r.left, r.top, txt, StdFont().Bold().Italic(),
                   style & CURSOR ? ink : HighlightSetup::GetHlStyle(HighlightSetup::INK_KEYWORD).color);
        return GetTextSize(txt, StdFont().Bold().Italic()).cx;
    }
    String h = q;
    if(*h == '\xff')
        return PaintFileName(w, r, h, ink);
    else
        h = FormatNest(h);
    w.DrawText(r.left, r.top, h, StdFont().Bold(), ink);
    return GetTextSize(h, StdFont().Bold()).cx;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:17,代码来源:Navigator.cpp

示例10: Paint

void ExGridCtrl::Paint(Draw &w)
{
    GridCtrl::Paint(w);

    if (GetCount() == 0)
        w.DrawText(GetSize().cx / 2 - _X, GetSize().cy / 2 - _Y - _Offset,
            _Info, _Font, _Ink);
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:8,代码来源:ExGridCtrl.cpp

示例11: fnt

//==============================================================================================
/*virtual*/ void TightFontDisplayForArrayCtrl::Paint(Draw& w, const Rect& r, const Value& q,
                   Color ink, Color paper, dword style) const
{
    Font fnt(FontZ(Font::COURIER, 9));
    String txt = q;
    w.DrawRect(r, paper);
    w.DrawText(r.left + 2, r.top + (r.Height() - GetTextSize(txt, fnt).cy) / 2, txt, fnt, ink); // <- Change is here - "w." no more needed
}
开发者ID:radtek,项目名称:lister,代码行数:9,代码来源:UrpPaint.cpp

示例12: Paint

    virtual void Paint(Draw& w, const Rect& r, const Value& q,
                       Color ink, Color paper, dword style) const
    {
        Font fnt = Font(q, r.Height() - 2);
        String txt = Font::GetFaceName(q);
        w.DrawRect(r, paper);
        w.DrawText(r.left + 2, r.top + (r.Height() - GetTextSize(txt, fnt).cy) / 2, txt, fnt, ink);
    }
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:8,代码来源:Display.cpp

示例13: Paint

    virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const {
        ValueArray va = q;
        String txt = va[0];
        Image icon = va[1];
        w.DrawRect(r, paper);
        w.DrawImage(r.left, r.top + (r.Height() - 16) / 2, IsNull(icon) ? IdeImg::Package() : icon);
        w.DrawText(r.left + 20, r.top + (r.Height() - Draw::GetStdFontCy()) / 2, txt, fnt, ink);
    }
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:8,代码来源:SelectPkg.cpp

示例14: 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());
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:9,代码来源:property.cpp

示例15: DrawTLText

void DrawTLText(Draw& draw, int x, int y, int cx, const wchar *text,
                Font font, Color ink, int accesskey) {
    int cy = font.Info().GetHeight();
    const wchar *s = text;
    const wchar *t = s;
    int apos = HIWORD(accesskey);
    int akey = LOWORD(accesskey);
    for(;;) {
        if(*s == '\n' || *s == '\0') {
            int a = x;
            const wchar *q = t;
            const wchar *start = NULL; 
            while(q < s) {
                while(q < s && *q < ' ') {
                    if(*q == '\t')
                        a = (a - x + 2 * cy) / (2 * cy) * (2 * cy) + x;
                    q++;
                }
                t = q;
                bool ak = false;
                start = q;
                while(q < s && *q >= ' ') {
                    if(akey && ToUpper(ToAscii(*q)) == akey && (apos == 0 || q - start + 1 == apos)) {
                        ak = true;
                        akey = 0;
                        break;
                    }
                    q++;
                }
                start = NULL;
                draw.DrawText(a, y, t, font, ink, (int)(q - t));
                a += GetTextSize(t, font, (int)(q - t)).cx;
                if(ak) {
                    draw.DrawText(a, y, q, font().Underline(), ink, 1);
                    a += GetTextSize(q, font().Underline(), 1).cx;
                    q++;
                }
            }
            t = s + 1;
            y += cy;
        }
        if(*s++ == '\0') break;
    }
}
开发者ID:pedia,项目名称:raidget,代码行数:44,代码来源:DrawTextUtil.cpp


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