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


C++ wxDC::SetTextBackground方法代码示例

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


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

示例1: DrawInvisible

void wxHtmlColourCell::DrawInvisible(wxDC& dc,
                                     int WXUNUSED(x), int WXUNUSED(y),
                                     wxHtmlRenderingInfo& info)
{
    wxHtmlRenderingState& state = info.GetState();
    if (m_Flags & wxHTML_CLR_FOREGROUND)
    {
        state.SetFgColour(m_Colour);
        if (state.GetSelectionState() != wxHTML_SEL_IN)
            dc.SetTextForeground(m_Colour);
        else
            dc.SetTextForeground(
                info.GetStyle().GetSelectedTextColour(m_Colour));
    }
    if (m_Flags & wxHTML_CLR_BACKGROUND)
    {
        state.SetBgColour(m_Colour);
        if (state.GetSelectionState() != wxHTML_SEL_IN)
        {
            dc.SetTextBackground(m_Colour);
            dc.SetBackground(wxBrush(m_Colour, wxSOLID));
        }
        else
        {
            wxColour c = info.GetStyle().GetSelectedTextBgColour(m_Colour);
            dc.SetTextBackground(c);
            dc.SetBackground(wxBrush(c, wxSOLID));
        }
    }
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:30,代码来源:htmlcell.cpp

示例2: SetTextColoursAndFont

void wxSheetCellStringRendererRefData::SetTextColoursAndFont(wxSheet& sheet,
        const wxSheetCellAttr& attr,
        wxDC& dc,
        bool isSelected)
{
    dc.SetBackgroundMode( wxTRANSPARENT );

    // TODO some special colours for attr.IsReadOnly() case?

    // different coloured text when the sheet is disabled
    if ( sheet.IsEnabled() )
    {
        if ( isSelected )
        {
            dc.SetTextBackground( sheet.GetSelectionBackground() );
            dc.SetTextForeground( sheet.GetSelectionForeground() );
        }
        else
        {
            dc.SetTextBackground( attr.GetBackgroundColour() );
            dc.SetTextForeground( attr.GetForegroundColour() );
        }
    }
    else
    {
        dc.SetTextBackground(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
        dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT));
    }

    dc.SetFont( attr.GetFont() );
}
开发者ID:stahta01,项目名称:wxCode_components,代码行数:31,代码来源:sheetren.cpp

示例3: DrawTextLine

void wxStdRenderer::DrawTextLine(wxDC& dc,
                                 const wxString& text,
                                 const wxRect& rect,
                                 int selStart,
                                 int selEnd,
                                 int flags)
{
    if ( (selStart == -1) || !(flags & wxCONTROL_FOCUSED) )
    {
        // just draw it as is
        dc.DrawText(text, rect.x, rect.y);
    }
    else // we have selection
    {
        wxCoord width,
                x = rect.x;

        // draw the part before selection
        wxString s(text, (size_t)selStart);
        if ( !s.empty() )
        {
            dc.DrawText(s, x, rect.y);

            dc.GetTextExtent(s, &width, NULL);
            x += width;
        }

        // draw the selection itself
        s = wxString(text.c_str() + selStart, text.c_str() + selEnd);
        if ( !s.empty() )
        {
            wxColour colFg = dc.GetTextForeground(),
                     colBg = dc.GetTextBackground();
            dc.SetTextForeground(wxSCHEME_COLOUR(m_scheme, HIGHLIGHT_TEXT));
            dc.SetTextBackground(wxSCHEME_COLOUR(m_scheme, HIGHLIGHT));
            dc.SetBackgroundMode(wxSOLID);

            dc.DrawText(s, x, rect.y);
            dc.GetTextExtent(s, &width, NULL);
            x += width;

            dc.SetBackgroundMode(wxTRANSPARENT);
            dc.SetTextBackground(colBg);
            dc.SetTextForeground(colFg);
        }

        // draw the final part
        s = text.c_str() + selEnd;
        if ( !s.empty() )
        {
            dc.DrawText(s, x, rect.y);
        }
    }
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:54,代码来源:stdrend.cpp

示例4: Draw

void HexEditLineBuffer::Draw( wxDC& dc, int x, int y, int fontX, int fontY, wxColour* foregrounds, wxColour* backgrounds )
{
    for ( char* ptr = m_Buffer; ptr < m_End; )
    {
        // Searching for continous block with same style
        wxString str;

        do
        {
            str += wxChar( ptr[ 0 ] );
            ptr += 2;
        }
        while ( ( ptr < m_End ) && ( ptr[1] == ptr[-1] ) );

        char style = ptr[-1];

        dc.SetBrush( backgrounds[ (int)style ] );
        dc.SetPen( backgrounds[ (int)style ] );

        dc.DrawRectangle( x, y, fontX * str.length(), fontY );

        dc.SetPen( foregrounds[ (int)style ] );
        dc.SetTextForeground( foregrounds[ (int)style ] );
        dc.SetTextBackground( backgrounds[ (int)style ] );

        dc.DrawText( str, x, y );
        x += fontX * str.length();
    }
}
开发者ID:469306621,项目名称:Languages,代码行数:29,代码来源:HexEditLineBuffer.cpp

示例5: Render

/**
 * Render the event in the bitmap
 */
void LinkEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform)
{
#if !defined(GD_NO_WX_GUI)
    gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get();

    dc.SetBrush( wxBrush( wxColour( 255, 255, 255 ) ) );
    dc.SetPen( wxPen( wxColour( 0, 0, 0 ), 1) );
    wxRect rect(x+1, y, width-2, GetRenderedHeight(width, platform)-2);
    dc.DrawRectangle(rect);

    dc.DrawBitmap( gd::SkinHelper::GetIcon("events", 24), x+4, y + 1, true);

    dc.SetTextBackground( wxColour( 255, 255, 255 ) );
    if ( !IsDisabled() )
        dc.SetTextForeground( wxColour( 0, 0, 0 ) );
    else
        dc.SetTextForeground( wxColour( 160, 160, 160 ) );

    dc.SetFont(renderingHelper->GetNiceFont());
    dc.DrawText( _("Link to ")+GetTarget(), x+32, y + 3 );

    if ( GetIncludeConfig() == INCLUDE_BY_INDEX )
    {
        wxRect textRect = dc.GetTextExtent(_("Link to ")+GetTarget());
        dc.DrawText( _("Include only events ")+gd::String::From(GetIncludeStart()+1)+_(" to ")+gd::String::From(GetIncludeEnd()+1), x+textRect.GetWidth()+32+10, y + 5 );
    }
    else if ( GetIncludeConfig() == INCLUDE_EVENTS_GROUP )
    {
        wxRect textRect = dc.GetTextExtent(_("Link to ")+GetTarget());
        dc.DrawText( _("Include only the events group named \"")+gd::String::From(GetEventsGroupName())+_("\""), x+textRect.GetWidth()+32+10, y + 5 );
    }
#endif
}
开发者ID:trinajstica,项目名称:GD,代码行数:36,代码来源:LinkEvent.cpp

示例6: Render

/**
 * Render the event in the bitmap
 */
void LinkEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform)
{
#if !defined(GD_NO_WX_GUI)
    dc.SetBrush( wxBrush( wxColour( 255, 255, 255 ) ) );
    dc.SetPen( wxPen( wxColour( 0, 0, 0 ), 1) );
    wxRect rect(x+1, y, width, GetRenderedHeight(width, platform)-2);
    dc.DrawRectangle(rect);

    dc.DrawBitmap( gd::SkinHelper::GetIcon("events", 24), x+4, y + 1, true);

    dc.SetTextBackground( wxColour( 255, 255, 255 ) );
    if ( !IsDisabled() )
        dc.SetTextForeground( wxColour( 0, 0, 0 ) );
    else
        dc.SetTextForeground( wxColour( 160, 160, 160 ) );
    dc.SetFont( wxFont( 12, wxDEFAULT, wxNORMAL, wxNORMAL ) );
    dc.DrawText( _("Link to ")+GetTarget(), x+32, y + 3 );
    wxRect lien = dc.GetTextExtent(_("Link to ")+GetTarget());

    dc.SetFont( wxFont( 10, wxDEFAULT, wxNORMAL, wxNORMAL ) );
    if ( IncludeAllEvents() )
        dc.DrawText( _("Include all events"), x+lien.GetWidth()+32+10, y + 5 );
    else
        dc.DrawText( _("Include events ")+ToString(GetIncludeStart()+1)+_(" to ")+ToString(GetIncludeEnd()+1), x+lien.GetWidth()+32+10, y + 5 );
#endif
}
开发者ID:kumarjith,项目名称:GD,代码行数:29,代码来源:LinkEvent.cpp

示例7: PaintShapes

void TestScrollWinCanvas::PaintShapes(wxDC& dc)
{
	TemplateCanvas::PaintShapes(dc);
	dc.SetPen(*wxBLACK_PEN);
	dc.SetBrush(*wxRED_BRUSH);
	dc.SetTextForeground(*wxBLACK);
	dc.SetTextBackground(wxTransparentColor); // new const in wxWidgets 2.9.1
	dc.SetFont(*wxSMALL_FONT);
	int y=10;
	int dy=20;
	int i=0;
	dc.DrawLine(30,30, 250,15);
	dc.DrawText("*wxSMALL_FONT", 10, y+(dy*i++));
	dc.SetFont(*wxNORMAL_FONT);
	dc.DrawText("*wxNORMAL_FONT", 10, y+(dy*i++));
	dc.SetFont(wxSystemSettings::GetFont(wxSYS_ANSI_VAR_FONT));
	dc.DrawText("GetFont(wxSYS_ANSI_VAR_FONT)", 10, y+(dy*i++));
	dc.SetFont(wxSystemSettings::GetFont(wxSYS_SYSTEM_FONT));
	dc.DrawText("GetFont(wxSYS_SYSTEM_FONT)", 10, y+(dy*i++));
	wxFont f1(8, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
	dc.SetFont(f1);
	dc.DrawText("8, wxFONTFAMILY_SWISS", 10, y+(dy*i++));
	wxFont f1_1(9, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
	dc.SetFont(f1_1);
	dc.DrawText("9, wxFONTFAMILY_SWISS", 10, y+(dy*i++));	
	wxFont f2(10, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
	dc.SetFont(f2);
	dc.DrawText("10, wxFONTFAMILY_SWISS", 10, y+(dy*i++));
	wxFont f3(11, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
	dc.SetFont(f3);
	dc.DrawText("11, wxFONTFAMILY_SWISS", 10, y+(dy*i++));
	wxFont f4(12, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
	dc.SetFont(f4);
	dc.DrawText("12, wxFONTFAMILY_SWISS", 10, y+(dy*i++));
	wxFont f5(14, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
	dc.SetFont(f5);
	dc.DrawText("14, wxFONTFAMILY_SWISS", 10, y+(dy*i++));
	f5.SetPointSize(16);
	dc.SetFont(f5);
	dc.DrawText("16, wxFONTFAMILY_SWISS", 10, y+(dy*i++));
	f5.SetPixelSize(wxSize(0,15));
	dc.SetFont(f5);
	dc.DrawText("SetPixelSize(0,15), wxFONTFAMILY_SWISS", 10, y+(dy*i++));
	f5.SetPixelSize(wxSize(0,10));
	dc.SetFont(f5);
	dc.DrawText("SetPixelSize(0,10), wxFONTFAMILY_SWISS", 10, y+(dy*i++));
	f5.SetPixelSize(wxSize(0,20));
	dc.SetFont(f5);
	dc.DrawText("SetPixelSize(0,20), wxFONTFAMILY_SWISS", 10, y+(dy*i++));
	dc.SetFont(*GdaConst::small_font);
	dc.DrawText("*GdaConst::small_font", 10, y+(dy*i++));
	dc.SetFont(*GdaConst::medium_font);
	dc.DrawText("*GdaConst::medium_font", 10, y+(dy*i++));
	dc.SetTextForeground(GdaConst::selectable_fill_color);
	dc.SetFont(*GdaConst::large_font);
	dc.DrawText("*GdaConst::large_font", 10, y+(dy*i++));
}
开发者ID:LreeLenn,项目名称:geoda,代码行数:57,代码来源:TestScrollWinView.cpp

示例8: DrawPaperBar

//---------------------------------------------------------------------------
void wxPagedWindow::DrawPaperBar( twTabInfo& tab, int x, int y,
                                  wxBrush& brush, wxPen& pen, wxDC& dc )
{
    wxPoint poly[4];

    // draw organizer-style paper outlet

    poly[0].x = x - mTabTrianGap;
    poly[0].y = y;

    poly[1].x = x + mTabTrianGap;
    poly[1].y = y + tab.mDims.y-1;

    poly[2].x = x + tab.mDims.x - mTabTrianGap;
    poly[2].y = y + tab.mDims.y-1;

    poly[3].x = x + tab.mDims.x + mTabTrianGap;
    poly[3].y = y;

    dc.SetPen( pen );
    dc.SetBrush( brush );

    dc.DrawPolygon( 4, poly );

    long w,h;

    // set select default font of the window into it's device context
    //dc.SetFont( GetLabelingFont() );

    dc.SetTextBackground( brush.GetColour() );

    dc.GetTextExtent(tab.mText, &w, &h );

    if ( tab.HasImg() )
    {
        wxMemoryDC tmpDc;
        tmpDc.SelectObject( tab.GetImg() );

        dc.Blit( x + mTitleHorizGap,
            y + ( tab.mDims.y - tab.ImgHeight() ) / 2,
            tab.ImgWidth(),
            tab.ImgHeight(),
            &tmpDc, 0, 0, wxCOPY
            );
    }

    if ( tab.HasText() )
    {
        int tx = x + mTitleHorizGap +
            tab.ImgWidth() + tab.ImageToTxtGap(mImageTextGap);

        dc.DrawText( tab.GetText(), tx, y + ( tab.mDims.y - h ) / 2 );
    }
}  // wxPagedWindow::DrawPaperBar()
开发者ID:BackupTheBerlios,项目名称:wxbeos-svn,代码行数:55,代码来源:tabpgwin.cpp

示例9: DisplayScore

void Game::DisplayScore(wxDC& dc)
{
    wxColour bgColour = FortyApp::BackgroundColour();
    wxPen* pen = wxThePenList->FindOrCreatePen(bgColour, 1, wxSOLID);
    dc.SetTextBackground(bgColour);
    dc.SetTextForeground(FortyApp::TextColour());
    dc.SetBrush(FortyApp::BackgroundBrush());
    dc.SetPen(* pen);

    // count the number of cards in foundations
    m_currentScore = 0;
    for (int i = 0; i < 8; i++)
    {
        m_currentScore += m_foundations[i]->GetNumCards();
    }

    int x, y;
    m_pack->GetTopCardPos(x, y);
    x += 12 * CardWidth - 105;

    wxCoord w, h;
    {
        wxCoord width, height;
        dc.GetTextExtent(wxT("Average score:m_x"), &width, &height);
        w = width;
        h = height;
    }
    dc.DrawRectangle(x + w, y, 20, 4 * h);

    wxString str;
    str.Printf(wxT("%d"), m_currentScore);
    dc.DrawText(wxT("Score:"), x, y);
    dc.DrawText(str, x + w, y);
    y += h;

    str.Printf(wxT("%d"), m_numGames);
    dc.DrawText(wxT("Games played:"), x, y);
    dc.DrawText(str, x + w, y);
    y += h;

    str.Printf(wxT("%d"), m_numWins);
    dc.DrawText(wxT("Games won:"), x, y);
    dc.DrawText(str, x + w, y);
    y += h;

    int average = 0;
    if (m_numGames > 0)
    {
        average = (2 * (m_currentScore + m_totalScore) + m_numGames ) / (2 * m_numGames);
    }
    str.Printf(wxT("%d"), average);
    dc.DrawText(wxT("Average score:"), x, y);
    dc.DrawText(str, x + w, y);
}
开发者ID:crankycoder,项目名称:wxPython-2.9.2.4,代码行数:54,代码来源:game.cpp

示例10: DrawTextNoClip

void SurfaceImpl::DrawTextNoClip(PRectangle rc, Font &font, int ybase,
                                 const char *s, int len,
                                 ColourAllocated fore, ColourAllocated back) {
    SetFont(font);
    hdc->SetTextForeground(wxColourFromCA(fore));
    hdc->SetTextBackground(wxColourFromCA(back));
    FillRectangle(rc, back);

    // ybase is where the baseline should be, but wxWin uses the upper left
    // corner, so I need to calculate the real position for the text...
    hdc->DrawText(stc2wx(s, len), rc.left, ybase - font.ascent);
}
开发者ID:barsnadcat,项目名称:steelandconcrete,代码行数:12,代码来源:PlatWX.cpp

示例11: drawIsoLineLabels

void IsoLine::drawIsoLineLabels(GRIBOverlayFactory *pof, wxDC &dc, wxColour text_color, wxColour back_color,
                                PlugIn_ViewPort *vp, int density, int first, double coef)
{
///
//#if 0
    std::list<Segment *>::iterator it;
    int nb = first;
    wxString label;

    label.Printf(_T("%d"), (int)(value*coef+0.5));

    wxPen penText(text_color);

    int w, h;
    dc.GetTextExtent(label, &w, &h);

    dc.SetPen(penText);
    dc.SetBrush(wxBrush(back_color));
    dc.SetTextForeground(text_color);
    dc.SetTextBackground(back_color);

    //---------------------------------------------------------
    // Ecrit les labels
    //---------------------------------------------------------
    for (it=trace.begin(); it!=trace.end(); it++,nb++)
    {
        if (nb % density == 0)
		{
            Segment *seg = *it;

//            if(vp->vpBBox.PointInBox((seg->px1 + seg->px2)/2., (seg->py1 + seg->py2)/2., 0.))
            {
 //                 wxPoint ab = vp->GetMercatorPixFromLL(seg->py1, seg->px1);
 //                 wxPoint cd = vp->GetMercatorPixFromLL(seg->py2, seg->px2);
			wxPoint ab;
			GetCanvasPixLL(vp, &ab, seg->py1, seg->px1);
			wxPoint cd;
			GetCanvasPixLL(vp, &cd, seg->py1, seg->px1);
                  
			int label_offset = 6;
                  int xd = (ab.x + cd.x-(w+label_offset * 2))/2;
                  int yd = (ab.y + cd.y - h)/2;

                 
                  dc.DrawRoundedRectangle(xd, yd, w+(label_offset * 2), h, -.25);
                  dc.DrawText(label, label_offset/2 + xd, yd-1);
            }

        }
    }
//#endif
///
}
开发者ID:fzschornack,项目名称:OpenCPN,代码行数:53,代码来源:IsoLine.cpp

示例12: DrawTextClipped

void SurfaceImpl::DrawTextClipped(PRectangle rc, Font &font, int ybase,
                                  const char *s, int len,
                                  ColourAllocated fore, ColourAllocated back) {
    SetFont(font);
    hdc->SetTextForeground(wxColourFromCA(fore));
    hdc->SetTextBackground(wxColourFromCA(back));
    FillRectangle(rc, back);
    hdc->SetClippingRegion(wxRectFromPRectangle(rc));

    // see comments above
    hdc->DrawText(stc2wx(s, len), rc.left, ybase - font.ascent);
    hdc->DestroyClippingRegion();
}
开发者ID:barsnadcat,项目名称:steelandconcrete,代码行数:13,代码来源:PlatWX.cpp

示例13: Redraw

void Pack::Redraw(wxDC& dc)
{
    Pile::Redraw(dc);

    wxString str;
    str.Printf(wxT("%d  "), m_topCard + 1);

    dc.SetBackgroundMode( wxSOLID );
    dc.SetTextBackground(FortyApp::BackgroundColour());
    dc.SetTextForeground(FortyApp::TextColour());
    dc.DrawText(str, m_x + CardWidth + 5, m_y + CardHeight / 2);

}
开发者ID:crankycoder,项目名称:wxPython-2.9.2.4,代码行数:13,代码来源:game.cpp

示例14: SwitchSelState

static void SwitchSelState(wxDC& dc, wxHtmlRenderingInfo& info,
                           bool toSelection)
{
    wxColour fg = info.GetState().GetFgColour();
    wxColour bg = info.GetState().GetBgColour();

    if ( toSelection )
    {
        dc.SetBackgroundMode(wxSOLID);
        dc.SetTextForeground(info.GetStyle().GetSelectedTextColour(fg));
        dc.SetTextBackground(info.GetStyle().GetSelectedTextBgColour(bg));
        dc.SetBackground(wxBrush(info.GetStyle().GetSelectedTextBgColour(bg),
                                 wxSOLID));
    }
    else
    {
        dc.SetBackgroundMode(wxTRANSPARENT);
        dc.SetTextForeground(fg);
        dc.SetTextBackground(bg);
        dc.SetBackground(wxBrush(bg, wxSOLID));
    }
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:22,代码来源:htmlcell.cpp

示例15: SetTextColoursAndFont

void wxGridCellStringRenderer::SetTextColoursAndFont(const wxGrid& grid,
                                                     const wxGridCellAttr& attr,
                                                     wxDC& dc,
                                                     bool isSelected)
{
    dc.SetBackgroundMode( wxBRUSHSTYLE_TRANSPARENT );

    // TODO some special colours for attr.IsReadOnly() case?

    // different coloured text when the grid is disabled
    if ( grid.IsThisEnabled() )
    {
        if ( isSelected )
        {
            wxColour clr;
            if ( grid.HasFocus() )
                clr = grid.GetSelectionBackground();
            else
                clr = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW);
            dc.SetTextBackground( clr );
            dc.SetTextForeground( grid.GetSelectionForeground() );
        }
        else
        {
            dc.SetTextBackground( attr.GetBackgroundColour() );
            dc.SetTextForeground( attr.GetTextColour() );
        }
    }
    else
    {
        dc.SetTextBackground(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
        dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT));
    }

    dc.SetFont( attr.GetFont() );
}
开发者ID:3v1n0,项目名称:wxWidgets,代码行数:36,代码来源:gridctrl.cpp


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