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


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

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


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

示例1: drawJoin

void gqbGraphSimple::drawJoin(wxMemoryDC& bdc, wxPoint& origin, wxPoint& dest, wxPoint& anchorUsed, bool selected=false, type_Join joinKind=_equally)
{
    wxPoint origin2=origin;
    wxPoint dest2=dest;

    if(selected)
    {
        bdc.SetPen(selectedPen);
        bdc.SetBrush(selectedBrush);
    }
    else
    {
        bdc.SetPen(*wxBLACK_PEN);
        bdc.SetBrush(*wxBLACK_BRUSH);
    }

    // GQB-TODO: optimize this if possible, I know one other can be the same?

    // getAnchorsUsed() [-1==left]   [1==right] x->origin y->destination
    if(anchorUsed.x==1)
    {
        bdc.DrawRectangle(origin.x,origin.y-4,8,8);
        origin2.x+=20;
    }
    else
    {
        bdc.DrawRectangle(origin.x-8,origin.y-4,8,8);
        origin2.x-=20;
    }

    if(anchorUsed.y==1)
    {
        bdc.DrawRectangle(dest.x,dest.y-4,8,8);
        dest2.x+=20;
    }
    else
    {
        bdc.DrawRectangle(dest.x-8,dest.y-4,8,8);
        dest2.x-=20;
    }

    bdc.DrawLine(origin,origin2);
    bdc.DrawLine(dest,dest2);
    bdc.DrawLine(origin2,dest2);

    // Draw type of join
    switch(joinKind)
    {
        case _equally:
            bdc.DrawText(wxT("="),findLineMiddle(origin2, dest2));
            break;
        case _lesser:
            bdc.DrawText(wxT("<"),findLineMiddle(origin2, dest2));
            break;
        case _greater:
            bdc.DrawText(wxT(">"),findLineMiddle(origin2, dest2));
            break;
        case _equlesser:
            bdc.DrawText(wxT("<="),findLineMiddle(origin2, dest2));
            break;
        case _equgreater:
            bdc.DrawText(wxT(">="),findLineMiddle(origin2, dest2));
            break;
    };
}
开发者ID:xiul,项目名称:Database-Designer-for-pgAdmin,代码行数:65,代码来源:gqbGraphSimple.cpp

示例2: drawTable

// NOTES:(1) store values of width & height at queryTable.
// (2)Need to set a font for the device context before get font metrics with GetTextExtent
void gqbGraphSimple::drawTable(wxMemoryDC& bdc, wxPoint *origin, gqbQueryObject *queryTable)
{
    long  w=0,h=0,height=0,width=0,margin=5;

    // Get Value for row Height
    if(!rowHeight)
    {
        bdc.SetFont(TableTitleFont);
        bdc.GetTextExtent(wxT("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxtz"),&w,&h);
        rowHeight=h;
    }

    // Get Title Metrics
    bdc.SetFont(TableTitleFont);
    height+= rowHeight + rowTopMargin;

    // Calculate font metrics for table title with/without alias
    if(queryTable->getAlias().length()>0)
        bdc.GetTextExtent(queryTable->getName()+wxT(" (")+queryTable->getAlias()+wxT(")"),&w,&h);
    else
        bdc.GetTextExtent(queryTable->getName(),&w,&h);
    width= rowLeftMargin + w + rowRightMargin;

    // Get Columns Metrics
    bdc.SetFont(normalFont);

    // Don't use h value from font metrics to get consistency between columns vertical separation (height)
    height+=rowHeight*queryTable->parent->countCols()+rowTopMargin*queryTable->parent->countCols();
    gqbIteratorBase *iterator = queryTable->parent->createColumnsIterator();
    while(iterator->HasNext())
    {
        gqbColumn *tmp= (gqbColumn *)iterator->Next();
        bdc.GetTextExtent(tmp->getName(),&w,&h);
        if((rowLeftMargin + w + rowRightMargin) > width)
            width=rowLeftMargin + w + rowRightMargin;
    }

    //Don't delete iterator because will be use below;

	// Set table Size in ObjectModel (Temporary Values for object representation,
	// and for this reason the view can modified model without using the controller
	// because this values are used by controller when use object's size in internal operations)
    if( (height+2) < minTableHeight) // +2 from BackgroundLayers addition
    {
        queryTable->setHeight(minTableHeight);    
        height=minTableHeight;
    }
    else
        queryTable->setHeight(height+2);

    if( (width+2) < minTableWidth)
    {
        queryTable->setWidth(minTableWidth);
        width=minTableWidth;
    }
    else
        queryTable->setWidth(width+2);

    //Decorate Table
    bdc.SetPen(*wxTRANSPARENT_PEN);

    //draw second Layer
    bdc.SetBrush(BackgroundLayer2);
    bdc.DrawRectangle(wxRect(wxPoint(origin->x,origin->y), wxSize(width+2,height+2)));

    //draw third Layer
    bdc.SetBrush(BackgroundLayer1);
    bdc.DrawRectangle(wxRect(wxPoint(origin->x,origin->y), wxSize(width+1,height+1)));

    //draw real frame layer
    bdc.SetBrush(*wxWHITE_BRUSH);
    if(queryTable->getSelected())
    {
        bdc.SetPen(selectedPen);
    }
    else
    {
        bdc.SetPen(*wxBLACK_PEN);
    }
    bdc.DrawRectangle(wxRect(wxPoint(origin->x,origin->y), wxSize(width,height)));

    //draw title layer
    bdc.SetBrush(BackgroundTitle);
    bdc.DrawRectangle(wxRect(wxPoint(origin->x,origin->y), wxSize(width,rowHeight+rowTopMargin)));
    bdc.SetFont(TableTitleFont);
    if(queryTable->getAlias().length()>0)
        bdc.DrawText(queryTable->getName()+wxT(" (")+queryTable->getAlias()+wxT(")"),origin->x+margin,origin->y+rowTopMargin);
    else
        bdc.DrawText(queryTable->getName(),origin->x+margin,origin->y+rowTopMargin);
    bdc.SetFont(normalFont);

    // GQB-TODO: in a future reuse a little more the iterator creating it inside the Query or Table Object
    // and only delete it when delete the query object.

    // Draw Columns
    height=rowHeight+rowTopMargin;
    iterator->ResetIterator();
    while(iterator->HasNext())
//.........这里部分代码省略.........
开发者ID:xiul,项目名称:Database-Designer-for-pgAdmin,代码行数:101,代码来源:gqbGraphSimple.cpp

示例3: Paint

void wxListSelection::Paint(wxMemoryDC &dc)
{
	const StringArray &displayOrder = mParent->GetDisplayOrder();
	wxASSERT(false == displayOrder.empty());
	wxASSERT(displayOrder.size() == mpImpl->mPoints.size());

	wxSize size = GetSize();
	wxColour background = mpImpl->mBackground;

	// Set background color.
	if(mpImpl->mIsHighlight && mpImpl->mIsSelected)
	{
		background = mpImpl->mHighlightAndSelected;
	}
	else if(mpImpl->mIsHighlight)
	{
		background = mpImpl->mHighlight;
	}
	else if(mpImpl->mIsSelected)
	{
		background = mpImpl->mSelected;
	}

	dc.SetPen(wxPen(background));
	dc.SetBrush(wxBrush(background));
	dc.DrawRectangle(0, 0, size.x, size.y);

	// Bitmap (if any)
	if(true == mpImpl->mBitmap.Ok())
	{
		dc.DrawBitmap(mpImpl->mBitmap, sImageBufferX, mpImpl->mImageBufferY, true);
	}

	// Draw text.
	dc.SetFont(mpImpl->mMainFont);
	wxColour shadow = mpImpl->mMainTextShadow;
	wxColour main = IsEnabled() ? mpImpl->mMainText : 
		mpImpl->mMainTextDisabled;
	for(size_t i = 0; i < displayOrder.size(); ++i)
	{
		if(1 == i)
		{
			dc.SetFont(mpImpl->mSubFont);
			shadow = mpImpl->mSubTextShadow;
			main = mpImpl->mSubText;
		}

		const wxString &str = mpImpl->mFields[displayOrder[i]];

		if(false == str.IsEmpty())
		{
			const wxPoint &point = mpImpl->mPoints[i];

			if(shadow != mpImpl->mTransparent)
			{
				dc.SetTextForeground(shadow);
				dc.DrawText(str, point.x + 1, point.y + 1);
			}
			dc.SetTextForeground(main);
			dc.DrawText(str, point.x, point.y);
		}
	}
}
开发者ID:Dangr8,项目名称:Cities3D,代码行数:63,代码来源:ListSelection.cpp


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