本文整理汇总了C++中TDC::TabbedTextOut方法的典型用法代码示例。如果您正苦于以下问题:C++ TDC::TabbedTextOut方法的具体用法?C++ TDC::TabbedTextOut怎么用?C++ TDC::TabbedTextOut使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDC
的用法示例。
在下文中一共展示了TDC::TabbedTextOut方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
TTabCheckList::PaintText(TDC& dc, const TRect& textRect, const tstring& text)
{
dc.ExtTextOut(textRect.TopLeft(), ETO_OPAQUE, &textRect, _T(""), 0, 0);
dc.TabbedTextOut(textRect.TopLeft(), text, -1, TabStops.Size(), &TabStops[0], textRect.left);
}
示例2: Paint
//
// Paint routine for Window, Printer, and PrintPreview for a TEdit/TListBox client.
//
void poundsMDIChild::Paint (TDC& dc, BOOL, TRect& rect)
{
poundsApp *theApp = TYPESAFE_DOWNCAST(GetApplication(), poundsApp);
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);
HFONT hFont = (HFONT)GetClientWindow()->GetWindowFont();
TFont font("Arial", -12);
if (hFont == 0)
dc.SelectObject(font);
else
dc.SelectObject(TFont(hFont));
TEXTMETRIC tm;
int fHeight = (dc.GetTextMetrics(tm) == TRUE) ? tm.tmHeight + tm.tmExternalLeading : 10;
// How many lines of this font can we fit on a page.
int linesPerPage = MulDiv(pageSize.cy, 1, fHeight);
if (linesPerPage) {
TPrintDialog::TData &printerData = theApp->Printer->GetSetup();
int maxPg = 1;
// Get the client class window (this is the contents we're going to print).
TEdit *clientEditWindow /* = 0*/;
TListBox *clientListWindow = 0;
TWindow *clientUnknownWindow = 0;
clientEditWindow = TYPESAFE_DOWNCAST(GetClientWindow(), TEdit);
if (clientEditWindow)
maxPg = ((clientEditWindow->GetNumLines() / linesPerPage) + 1.0);
else {
clientListWindow = TYPESAFE_DOWNCAST(GetClientWindow(), TListBox);
if (clientListWindow)
maxPg = ((clientListWindow->GetCount() / linesPerPage) + 1.0);
else
clientUnknownWindow = TYPESAFE_DOWNCAST(GetClientWindow(), TWindow);
}
// Compute the number of pages to print.
printerData.MinPage = 1;
printerData.MaxPage = maxPg;
// Do the text stuff:
int fromPage = printerData.FromPage == -1 ? 1 : printerData.FromPage;
int toPage = printerData.ToPage == -1 ? 1 : printerData.ToPage;
char buffer[255];
int currentPage = fromPage;
while (currentPage <= toPage) {
int startLine = (currentPage - 1) * linesPerPage;
int lineIdx = 0;
while (lineIdx < linesPerPage) {
// If the string is no longer valid then there's nothing more to display.
if (clientEditWindow) {
if (!clientEditWindow->GetLine(buffer, sizeof(buffer), startLine + lineIdx))
break;
}
else if (clientListWindow) {
if (clientListWindow->GetString(buffer, startLine + lineIdx) < 0)
break;
}
else if (clientUnknownWindow) {
clientUnknownWindow->Paint(dc, FALSE, rect);
break;
}
dc.TabbedTextOut(TPoint(0, lineIdx * fHeight), buffer, lstrlen(buffer), 0, NULL, 0);
lineIdx++;
}
currentPage++;
}
}
}
}
}