本文整理汇总了C++中TDC::TextOut方法的典型用法代码示例。如果您正苦于以下问题:C++ TDC::TextOut方法的具体用法?C++ TDC::TextOut怎么用?C++ TDC::TextOut使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDC
的用法示例。
在下文中一共展示了TDC::TextOut方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Print_Line
void TFuncSpecView::Print_Line(TDC& dc, TPoint origin, const TFuncSpecView::XPosVector& xpos, char* data) const
{
XPosVector::size_type i, count=xpos.size()-1; // subtract one for end marker
char text[]="+";
for(i=0; i<count; i++) {
text[0]=data[i];
dc.TextOut(origin.OffsetBy(xpos[i].x, 0), text, 1);
}
}
示例2: Paint
/////////////////////////////////////////////////////////////////////
// TInfoControl
// ------------
//
void TInfoControl::Paint (TDC& dc, BOOL erase, TRect& rect)
{
TControl::Paint(dc, erase, rect);
TRect cRect = GetClientRect();
// Select font
dc.SelectObject (*StaticFont);
dc.SetBkMode (TRANSPARENT);
// Draw each text line
if ( TextLineTab != NULL )
{
for (int i = 0 ; i < NumLines ; i++)
{
if (TextLineTab[i] != NULL && TextLineTab[i]->Text != NULL)
{
int x;
dc.SetTextColor ( TMapDC::GetColor16(TextLineTab[i]->Color));
dc.SetTextAlign( TextLineTab[i]->Align);
switch (TextLineTab[i]->Align & (TA_CENTER |TA_LEFT |TA_RIGHT))
{
case TA_LEFT:
x = 0;
break;
case TA_CENTER:
x = cRect.Width() / 2;
break;
case TA_RIGHT:
x = cRect.Width() - 1;
break;
}
dc.TextOut( x, FontHeight * i, TextLineTab[i]->Text);
}
}
}
dc.RestoreFont();
}
示例3: mdc
////////////////////////////////////////////////////////////
// TBitmap256Control
// -----------------
// Display bitmap in DC
void TBitmap256Control::DisplayBitmap (TDC& dc, TRect &rect)
{
// Display a cross if no bitmap
if ( pDIBInfo == 0 )
{
dc.SelectObject(TPen(TColor::LtGray));
dc.MoveTo (0, 0);
dc.LineTo (MaxWidth, MaxHeight);
dc.MoveTo (0, MaxHeight);
dc.LineTo (MaxWidth, 0);
dc.SetTextAlign(TA_CENTER);
dc.SetTextColor(TColor::White);
dc.SetBkColor(TColor::Black);
char tmp[40];
if ( BitmapName[0] != '\0' && BitmapName[0] != '-' )
wsprintf (tmp, "No picture (%s)", BitmapName);
else
wsprintf (tmp, "No picture");
dc.TextOut (MaxWidth / 2, MaxHeight / 2 - 6, tmp);
return;
}
assert (pBitmapPalette != NULL);
// pBitmapPalette->UnrealizeObject();
dc.SelectObject (*pBitmapPalette);
dc.RealizePalette();
dc.SetStretchBltMode (COLORONCOLOR);
#if 1
TRect ZoomRect;
ZoomRect.left = rect.left;
ZoomRect.top = rect.top;
ZoomRect.right = rect.right;
ZoomRect.bottom = rect.bottom;
// Convert the rect. size to a rect in the sprite
rect.left /= ZoomFactor;
rect.top /= ZoomFactor;
rect.right /= ZoomFactor;
rect.bottom /= ZoomFactor;
TRect DIBRect;
DIBRect.left = rect.left;
DIBRect.top = BitmapYSize - rect.bottom; // DIBs are Y inversed
DIBRect.right = DIBRect.left + rect.Width();
DIBRect.bottom = DIBRect.top + rect.Height();
dc.StretchDIBits (ZoomRect,
DIBRect,
pDIBits, *pDIBInfo,
DIB_PAL_COLORS, SRCCOPY);
#else
// Create memory DC and display bitmap
TMemoryDC mdc (dc);
mdc.SelectObject (*pBitmapPalette);
mdc.SelectObject (*pBitmap);
dc.StretchBlt(0, 0, ZoomXSize, ZoomYSize,
mdc,
0, 0, BitmapXSize, BitmapYSize,
SRCCOPY);
// Restore GDI objects
mdc.RestoreBitmap();
mdc.RestorePalette();
#endif
dc.RestorePalette();
}
示例4: Print_Summary
void TFuncSpecView::Print_Summary(TDC& dc, TRect rect) const
{
dc.TextOut(rect.TopLeft(), "[Insert System Summary Here]");
}
示例5: Paint
void TFuncSpecView::Paint(TDC& dc, bool erase, TRect& rect)
{
TSwitchMinApp* theApp = TYPESAFE_DOWNCAST(GetApplication(), TSwitchMinApp);
if (theApp) {
// Only paint if we're printing and we have something to paint, otherwise do nothing.
//
if (theApp->Printing && theApp->Printer && !rect.IsEmpty()) {
// Use pageSize to get the size of the window to render into. For a Window it's the client area,
// for a printer it's the printer DC dimensions and for print preview it's the layout window.
//
TSize pageSize(rect.right - rect.left, rect.bottom - rect.top);
TPrintDialog::TData& printerData = theApp->Printer->GetSetup();
// Get area we can draw in
TRect drawingArea(swdoc->PaintHeader(dc, rect, "", 0, 0, false), rect.BottomRight());
TEXTMETRIC tm;
dc.SelectObject(TFont("Arial", -12));
if (!dc.GetTextMetrics(tm)) {
dc.SelectObject(TFont("Arial", -12));
dc.GetTextMetrics(tm);
}
int fHeight=tm.tmHeight+tm.tmExternalLeading;
unsigned long inputs=swdoc->GetSystem()->GetInputs();
XPosVector xpos;
uint divider;
char* data;
Print_CreateWidths(xpos, divider, dc);
if (xpos.back().x < rect.Size().cx) { // put space in structure to stretch across page
uint spacing=(rect.Size().cx - xpos.back().x)/(xpos.size()+1);
uint space_inc=spacing;
for(XPosVector::size_type i=0; i<xpos.size(); i++) {
if (i==inputs) { // after inputs section, increase divider
divider += space_inc;
space_inc += spacing;
}
xpos[i].x += space_inc;
space_inc += spacing;
}
}
data=new char[xpos.size()];
unsigned long PagesDown=1+pow(2,inputs)/( (drawingArea.Size().cy/fHeight) - 2); // 2 lines for header and horz divider
unsigned long PagesAcross=1+xpos.back().x/drawingArea.Size().cx;
unsigned long Pages=1+PagesDown*PagesAcross;
// Compute the number of pages to print.
//
printerData.MinPage = 1;
printerData.MaxPage = Pages;
int fromPage = printerData.FromPage == -1 ? 1 : printerData.FromPage;
int toPage = printerData.ToPage == -1 ? 1 : printerData.ToPage;
int currentPage = fromPage;
TPoint p;
dc.SelectObject(TPen(TColor::Black));
while (currentPage <= toPage) {
swdoc->PaintHeader(dc, rect, "Specification", currentPage, Pages, true);
if (currentPage==1) Print_Summary(dc, drawingArea);
else {
// Calculate origin of line by page number
// x
int col=((currentPage-2) ) % PagesAcross;
p.x=drawingArea.left - col * drawingArea.Size().cx;
// y
int row=floor((currentPage-2)/PagesAcross);
p.y=drawingArea.top/* - row * drawingArea.Size().cy*/;
// Calculate starting and ending input states
CELL_TYPE state, stateEnd;
state=(row*(drawingArea.Size().cy-fHeight))/fHeight;
stateEnd=state+(drawingArea.Size().cy-fHeight)/fHeight;
if (stateEnd >= (pow(2,inputs)-1) ) stateEnd=pow(2,inputs)-1;
//
// Draw header and lines
// Vertical
if ( ((p.x+divider) > drawingArea.left) && ((p.x+divider)<drawingArea.right) ) {
dc.MoveTo(p.x+divider, p.y);
dc.LineTo(p.x+divider, p.y+((stateEnd-state)+3)*fHeight);
}
// Labels
for(XPosVector::size_type i=0; i<xpos.size(); i++)
dc.TextOut(TPoint(xpos[i].x, p.y), xpos[i].s.c_str());
p.y += fHeight;
// Horizontal
dc.MoveTo(drawingArea.left, p.y + fHeight/2);
dc.LineTo(p.x+xpos.back().x, p.y + fHeight/2);
//.........这里部分代码省略.........