本文整理汇总了C++中TDC::LineTo方法的典型用法代码示例。如果您正苦于以下问题:C++ TDC::LineTo方法的具体用法?C++ TDC::LineTo怎么用?C++ TDC::LineTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDC
的用法示例。
在下文中一共展示了TDC::LineTo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawIconicGauge
///////////////////////////////////////////////////////////////
// TLevelProgressDialog
// --------------------
//
void DrawIconicGauge(TDC &dc, int yPosition, int Width, int Height, int Value)
{
TBrush BleueBrush(TColor(0,0,255));
TPen BleuePen (TColor(0,0,255));
// TBrush GrayBrush (TColor(200,200,200));
TPen WhitePen (TColor(255,255,255));
TPen GrayPen (TColor(100,100,100));
// TPen GrayPen (TColor(0,0,0));
// Draw upper left white border
dc.SelectObject(GrayPen);
dc.MoveTo(0, yPosition + Height - 1);
dc.LineTo(0, yPosition);
dc.LineTo(Width - 1, yPosition);
// Draw lower right border
dc.SelectObject(WhitePen);
dc.LineTo(Width - 1, yPosition + Height - 1);
dc.LineTo(0, yPosition + Height - 1);
// Draw gauge
dc.SelectObject(BleueBrush);
dc.SelectObject(BleuePen);
dc.Rectangle(1, yPosition + 1, (Width - 1) * Value / 100, yPosition + Height - 1);
dc.RestoreObjects();
}
示例2: part
//
/// Puts the font into the device context and calls PaintGadgets.
///
/// Respond to virtual TWindow Paint call. Call our own virtual PaintGadgets
/// to actually perform the painting of the gadgets
//
void
TGadgetWindow::Paint(TDC& dc, bool erase, TRect& rect)
{
if (IsBackgroundThemed())
{
TThemePart part(GetHandle(), (LPCWSTR) L"REBAR", 0, 0);
part.DrawBackground(dc, GetClientRect(), rect);
erase = false;
}
dc.SelectObject(*Font);
PaintGadgets(dc, erase, rect);
#if defined(__TRACE) || defined(__WARN)
// Highlight the tools of this gadgetwindow for debugging purposes.
// Especially useful for docking windows which undergo internal state
// changes
//
TProfile iniFile(_T("Diagnostics"), _T(OWL_INI));
bool useDiagColor = iniFile.GetInt(_T("DiagToolbarBorders")) != 0;
if (useDiagColor && Tooltip && Tooltip->IsWindow()) {
uint count = Tooltip->GetToolCount();
if (count) {
TPen redPen(TColor(0xff, 0, 0));
dc.SelectObject(redPen);
TToolInfo ti;
while (count) {
if (Tooltip->EnumTools(--count, ti)) {
dc.MoveTo(ti.rect.left, ti.rect.top);
dc.LineTo(ti.rect.right,ti.rect.top);
dc.LineTo(ti.rect.right,ti.rect.bottom);
dc.LineTo(ti.rect.left, ti.rect.bottom);
dc.LineTo(ti.rect.left, ti.rect.top);
}
}
dc.RestorePen();
}
}
#endif
}
示例3: PaintButton
//
/// Paints a maximize box on the tiny caption bar.
//
void
TTinyCaption::PaintMaxBox(TDC& dc, TRect& boxRect, bool pressed)
{
// Fill the box with light gray & draw bevel if possible
//
PaintButton(dc, boxRect, pressed);
if (pressed)
boxRect.Offset(1,1);
// Down triangle
//
int bh = boxRect.Height();
int bw = boxRect.Width();
if (IsZoomed()) {
TPoint begPt = boxRect.BottomLeft().OffsetBy((bw+1)/4, -bh*3/8);
TPoint endPt = begPt.OffsetBy((bw+1)/2, 0);
while (begPt.x < endPt.x) {
dc.MoveTo(begPt);
dc.LineTo(endPt);
begPt.Offset(1,1);
endPt.Offset(-1,1);
}
}
// Up triangle
//
{
TPoint begPt = boxRect.TopLeft().OffsetBy((bw+1)/4, IsZoomed() ? bh*3/8 : bh*2/3);
TPoint endPt = begPt.OffsetBy((bw+1)/2, 0);
while (begPt.x < endPt.x) {
dc.MoveTo(begPt);
dc.LineTo(endPt);
begPt.Offset(1, -1);
endPt.Offset(-1, -1);
}
}
}
示例4: 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();
}
示例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);
//.........这里部分代码省略.........
示例6: Paint
//.........这里部分代码省略.........
/*
Compute the graph extent based on these label metrics
*/
rstart = tick_height + xlab_height + 1 ; // Ticks, X tick labels
rstop = rect.bottom - ylab_height/2 - 2 ; // Top half of topmost label
if (xlab_lw / 2 > ylab_width) // If left half of X label biggest
cstart = xlab_lw / 2 + 1 ; // Use it for offset
else
cstart = ylab_width + 2 ; // Otherwise Y labels determine it
cstop = rect.right - xlab_rw / 2 - 2 ; // Leave room for rightmost label
/*
Compute scales for data and ticks
*/
xscale = (double) (cstop - cstart) / (xmax - xmin) ;
xfac = (rightx - leftx) / (n-1) ;
yscale = (double) (rstop - rstart) / (ymax - ymin) ;
xtickscale = (double) (cstop-cstart) / (double) (xnticks-1) ;
ytickscale = (double) (rstop-rstart) / (double) (ynticks-1) ;
/*
Outline the graph, draw ticks, and write their labels
*/
dc.SelectObject ( *pen ) ;
dc.MoveTo ( cstart , b-rstart ) ;
dc.LineTo ( cstop , b-rstart ) ;
dc.LineTo ( cstop , b-rstop ) ;
dc.LineTo ( cstart , b-rstop ) ;
dc.LineTo ( cstart , b-rstart ) ;
dc.RestorePen () ;
for (i=0 ; i<ynticks ; i++) { /* Y ticks */
row = rstart + i * ytickscale + 0.5 ;
if (i && (i < ynticks-1)) { // Horizontal interior lines
dc.SelectObject ( *second_pen ) ;
dc.MoveTo ( cstart , b-row ) ;
dc.LineTo ( cstop , b-row ) ;
dc.RestorePen () ;
}
if (font_height) {
sprintf ( msg , "%*.*lf", yndigits, ynfrac, ymin + i * ydif ) ;
rect.bottom = b - (row - ylab_height / 2) ;
rect.top = rect.bottom - ylab_height - 1 ;
rect.right = cstart - 1 ;
rect.left = rect.right - ylab_width - 1 ;
dc.SelectObject ( *pen ) ;
dc.DrawText ( msg , -1 , rect , DT_SINGLELINE | DT_BOTTOM | DT_RIGHT );
dc.RestorePen () ;
}
}
dc.SelectObject ( *pen ) ;
prevcol = 0 ;
for (i=0 ; i<xnticks ; i++) { /* X ticks */
col = cstart + i * xtickscale + 0.5 ;
dc.MoveTo ( col , b-rstart ) ;
dc.LineTo ( col , b-(rstart - tick_height) ) ;
if (i) { /* Make an additional, unlabeled tick between main ones */