本文整理汇总了C++中TDC::RestoreObjects方法的典型用法代码示例。如果您正苦于以下问题:C++ TDC::RestoreObjects方法的具体用法?C++ TDC::RestoreObjects怎么用?C++ TDC::RestoreObjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDC
的用法示例。
在下文中一共展示了TDC::RestoreObjects方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: clientRect
//
/// Paints the DIB onto the window.
//
void
TPictureWindow::Paint(TDC& dc, bool /*erase*/, TRect& /*rect*/)
{
TPointer<TPalette> palette(0);
bool hasPalette = ToBool(dc.GetDeviceCaps(RASTERCAPS) & RC_PALETTE);
TDib* dib = GetDib();
if (dib) {
if (hasPalette) {
palette = new TPalette(*GetDib());
dc.SelectObject(*palette);
dc.RealizePalette();
}
// figure out upper left corner of the client area
//
TRect clientRect(GetClientRect());
TPoint sourcePoint(0, 0);
// adjust the upper left corner for centering picture
//
if (HowToDisplay == Center) {
// determine offsets
//
int offsetX = abs(dib->Width() - clientRect.Width()) / 2;
if (dib->Width() > clientRect.Width())
sourcePoint.x += offsetX;
else
clientRect.Offset(offsetX, 0);
int offsetY = abs(dib->Height() - clientRect.Height()) / 2;
if (dib->Height() > clientRect.Height())
sourcePoint.y += offsetY;
else
clientRect.Offset(0, offsetY);
}
// adjust the lower right corner
//
if (HowToDisplay != Stretch) {
clientRect.bottom = clientRect.top + dib->Height();
clientRect.right = clientRect.left + dib->Width();
// if the picture is larger than screen dimensions,
// adjust the upper left corner.
//
clientRect.top -= sourcePoint.y;
clientRect.left -= sourcePoint.x;
}
// display the dib
//
switch (HowToDisplay) {
case UpperLeft:
case Center:
dc.SetDIBitsToDevice(clientRect, sourcePoint, *dib);
// if(!dc.SetDIBitsToDevice(clientRect, sourcePoint, *dib)){
// TSystemMessage().MessageBox();
// }
break;
case Stretch: {
TRect sourceRect(0, 0, dib->Width(), dib->Height());
dc.StretchDIBits(clientRect, sourceRect, *dib);
break;
}
} // switch HowToDisplay
dc.RestoreObjects();
}
}