本文整理汇总了C++中TDC::RestoreBrush方法的典型用法代码示例。如果您正苦于以下问题:C++ TDC::RestoreBrush方法的具体用法?C++ TDC::RestoreBrush怎么用?C++ TDC::RestoreBrush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDC
的用法示例。
在下文中一共展示了TDC::RestoreBrush方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: brsh
//
/// Paints a 2-color single pixel-thick frame. Bevel corners get their own color.
//
void
TUIBorder::PaintFrameC(TDC& dc, const TRect& fr, uint flags, const TColor& tlColor, const TColor& brColor, const TColor& bcColor)
{
if (flags & (Top | Left)) {
TBrush brsh(tlColor);
dc.SelectObject(brsh);
if (flags & Top) {
dc.PatBlt(fr.left, fr.top, fr.Width()-2, 1);
dc.SetPixel(fr.right-1, fr.top, bcColor);
}
if (flags & Left)
dc.PatBlt(fr.left, fr.top+1, 1, fr.Height()-2);
dc.RestoreBrush();
}
if (flags & (Bottom | Right)) {
TBrush brsh(brColor);
dc.SelectObject(brsh);
if (flags & Bottom) {
dc.SetPixel(fr.left, fr.bottom-1, bcColor);
dc.PatBlt(fr.left+1, fr.bottom-1, fr.Width(), 1);
}
if (flags & Right)
dc.PatBlt(fr.right-1, fr.top, 1, fr.Height()-1);
dc.RestoreBrush();
}
}
示例2: DrawDisabledButton
void DrawDisabledButton(TDC& dc, const TRect& rc)
{
// create a monochrome memory DC
//
TMemoryDC ddc;
TBitmap bmp(ddc, rc.Width(), rc.Height());
ddc.SelectObject(bmp);
// build a mask
//
ddc.PatBlt(0, 0, rc.Width(), rc.Height(), WHITENESS);
dc.SetBkColor(TColor::Sys3dFace);
ddc.BitBlt(0, 0, rc.Width(), rc.Height(), dc, rc.left, rc.top, SRCCOPY);
dc.SetBkColor(TColor::Sys3dHilight);
ddc.BitBlt(0, 0, rc.Width(), rc.Height(), dc, rc.left, rc.top, SRCPAINT);
// Copy the image from the toolbar into the memory DC
// and draw it (grayed) back into the toolbar.
//
dc.FillRect(rc, TBrush(TColor::Sys3dFace));
dc.SetBkColor(RGB(0, 0, 0));
dc.SetTextColor(RGB(255, 255, 255));
TBrush brShadow(TColor::Sys3dShadow);
TBrush brHilight(TColor::Sys3dHilight);
dc.SelectObject(brHilight);
dc.BitBlt(rc.left+1, rc.top+1, rc.Width(), rc.Height(), ddc, 0, 0, 0x00E20746L);
dc.SelectObject(brShadow);
dc.BitBlt(rc.left, rc.top, rc.Width(), rc.Height(), ddc, 0, 0, 0x00E20746L);
// reset DCs
//
dc.RestoreBrush();
dc.RestoreBrush();
ddc.RestoreBitmap();
}
示例3: ColumnViewer
void TSensorView::ColumnViewer(TDC& dc,PSHORTREAL pData)
{
m_xSize = m_nDimSize[0];
m_ySize = m_nDimSize[1];
m_yAdd = (int) (500L * m_ySize / m_xSize / 2);
dc.SetWindowExt(TSize(m_xSize * 2 + m_ySize,500 + m_yAdd));
Grid3D(dc);
TBrush brGray(SYSCOLOR(COLOR_BTNFACE)),
brWhite(SYSCOLOR(COLOR_BTNHIGHLIGHT)),
brDark(SYSCOLOR(COLOR_BTNSHADOW));
for (int y = 0; y < m_nDimSize[1]; y++)
for (int x = 0; x < m_nDimSize[0]; x++)
{
SHORTREAL r = pData[x + (LONGINT) m_nDimSize[0] * y];
TPoint pt[4] =
{
Project2D(x,y+1,r),
Project2D(x+1,y+1,r),
Project2D(x+1,y,r),
Project2D(x,y,r)
};
dc.SelectObject(brWhite);
POLY(dc,pt,4);
SHORTREAL r2 = y == m_nDimSize[1]-1
? 0
: pData[x + (LONGINT) m_nDimSize[0] * (y+1)];
if(r2 < r)
{
pt[2] = Project2D(x+1,y+1,r2);
pt[3] = Project2D(x,y+1,r2);
dc.SelectObject(brGray);
POLY(dc,pt,4);
}
r2 = x == m_nDimSize[0]-1 ? 0
: pData[x+1 + (LONGINT) m_nDimSize[0] * y];
if (r2 < r)
{
pt[0] = Project2D(x+1,y,r);
pt[2] = Project2D(x+1,y+1,r2);
pt[3] = Project2D(x+1,y,r2);
dc.SelectObject(brDark);
POLY(dc,pt,4);
}
}
dc.RestoreBrush();
}
示例4: f
//
/// This is a static function that performs the actual drawing of edges for a
/// UIBorder or an external client. It uses the system ::DrawEdge if available.
//
bool
TUIBorder::DrawEdge(TDC& dc, const TRect& frame, uint edge, uint flags)
{
static int hasDrawEdge = true;
// Try once to see if the API call is available. If not, do ourselves.
//
if (hasDrawEdge) {
if (::DrawEdge(dc, (LPRECT)&frame, edge, flags))
return true;
if (::GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
hasDrawEdge = false;
else
return false;
}
// ::DrawEdge is not available, do the drawing ourselves
//
TRect f(frame); // working frame rectangle
// If mono is set, draw a thin, flat, black (windowFrame) frame
//
if (flags & Mono) {
if (edge & EdgeOuter) {
PaintFrame(dc, f, flags, TColor::SysWindowFrame, TColor::SysWindowFrame);
f.Inflate(-1,-1);
}
if (flags & Fill) { // !CQ repeated code--nest else?
TBrush brsh(TColor::SysWindow);
dc.SelectObject(brsh);
dc.PatBlt(f);
dc.RestoreBrush();
}
return true;
}
// If flat is set, draw a thin, flat, shadow frame
//
if (flags & Flat) {
if (edge & EdgeOuter) {
PaintFrame(dc, f, flags, TColor::Sys3dShadow, TColor::Sys3dShadow);
f.Inflate(-1,-1);
}
if (flags & Fill) { // !CQ repeated code--nest else?
TBrush brsh(TColor::Sys3dFace);
dc.SelectObject(brsh);
dc.PatBlt(f);
dc.RestoreBrush();
}
return true;
}
// Draw outer edge if indicated, adjusting rect afterwards
//
if (edge & EdgeOuter) {
static TColor tlColors[] = {
TColor::Sys3dLight, // EdgeRaised
TColor::Sys3dHilight, // EdgeRaised + Soft
TColor::Sys3dShadow, // EdgeSunken
TColor::Sys3dDkShadow, // EdgeSunken + Soft
};
static TColor brColors[] = {
TColor::Sys3dDkShadow, // EdgeRaised
TColor::Sys3dDkShadow, // EdgeRaised + Soft
TColor::Sys3dHilight, // EdgeSunken
TColor::Sys3dHilight, // EdgeSunken + Soft
};
int ci = ((edge & SunkenOuter) ? 2 : 0) | ((flags & Soft) ? 1 : 0);
PaintFrame(dc, f, flags, tlColors[ci], brColors[ci]);
f.Inflate(-1,-1);
}
// Draw inner edge if indicated, adjusting rect afterwards
//
if (edge & EdgeInner) {
static TColor tlColors[] = {
TColor::Sys3dHilight, // EdgeRaised
TColor::Sys3dLight, // EdgeRaised + Soft
TColor::Sys3dDkShadow, // EdgeSunken
TColor::Sys3dShadow, // EdgeSunken + Soft
};
static TColor brColors[] = {
TColor::Sys3dShadow, // EdgeRaised
TColor::Sys3dShadow, // EdgeRaised + Soft
TColor::Sys3dLight, // EdgeSunken
TColor::Sys3dLight, // EdgeSunken + Soft
};
int ci = ((edge & SunkenOuter) ? 2 : 0) | ((flags & Soft) ? 1 : 0);
PaintFrame(dc, f, flags, tlColors[ci], brColors[ci]);
f.Inflate(-1,-1);
}
// Fill interior if indicated
//
if (flags & Fill) {
TBrush brsh(TColor::Sys3dFace);
//.........这里部分代码省略.........
示例5: Paint
void npredictMDIChild::Paint ( TDC& dc , BOOL , TRect& )
{
int i, j, n, b, row, col, rstart, rstop, cstart, cstop, prevcol ;
int xlab_height, xlab_width, ylab_height, ylab_width, wide ;
int xlab_lw, xlab_rw, tick_height, font_height, r0, r1, c0 ;
double xscale, yscale, xtickscale, ytickscale, *sig, val ;
double x, xfac ;
char msg[256] ;
TRect rect ;
SIZE size ;
TColor bkgnd, *lines ;
TBrush *brush ;
TPen *pen, *second_pen ;
TFont *font ;
n = istop - istart + 1 ;
sig = signal->sig ;
dc.SetMapMode ( MM_TEXT ) ;
dc.SetROP2 ( R2_COPYPEN ) ;
dc.SetBkMode ( OPAQUE ) ;
bkgnd = dc.GetNearestColor ( TColor ( background_color ) ) ;
dc.SetBkColor ( bkgnd ) ;
GetClientRect ( rect ) ;
b = rect.bottom ; // We use origin at bottom, so b-y adapts to Windows
/*
Paint the background
*/
brush = new TBrush ( bkgnd ) ;
dc.SelectObject ( *brush ) ;
pen = new TPen ( bkgnd ) ;
dc.SelectObject ( *pen ) ;
dc.Rectangle ( rect ) ;
dc.RestoreBrush () ;
delete brush ;
dc.RestorePen () ;
delete pen ;
/*
Setup main drawing pen and secondary pen for hash lines
*/
lines = new TColor ( 0 , 0 , 0 ) ;
pen = new TPen ( *lines , 1 , PS_SOLID ) ;
second_pen = new TPen ( *lines , 1 , PS_DASH ) ;
/*
Compute the maximum height and width of the axis tick labels.
This lets us position the graph optimally.
*/
xlab_height = xlab_width = ylab_height = ylab_width = xlab_lw = xlab_rw = 0 ;
font_height = rect.bottom / 20 ;
if (rect.right / 24 < font_height)
font_height = rect.right / 24 ;
if (font_height < 8)
font_height = 0 ;
if (font_height) {
font = new TFont ( "Helvetica" , font_height ) ;
dc.SelectObject ( *font ) ;
for (i=0 ; i<xnticks ; i++) {
sprintf ( msg , "%*.*lf", xndigits, xnfrac, xmin + i * xdif ) ;
GetTextExtentPoint ( dc , msg , strlen(msg) , &size ) ;
if (! i)
xlab_lw = size.cx ; // Width of leftmost x label
if (i == xnticks-1)
xlab_rw = size.cx ; // And rightmost x label
if (size.cx > xlab_width)
xlab_width = size.cx ;
if (size.cy > xlab_height)
xlab_height = size.cy ;
}
for (i=0 ; i<ynticks ; i++) {
sprintf ( msg , "%*.*lf", yndigits, ynfrac, ymin + i * ydif ) ;
GetTextExtentPoint ( dc , msg , strlen(msg) , &size ) ;
if (size.cx > ylab_width)
ylab_width = size.cx ;
if (size.cy > ylab_height)
ylab_height = size.cy ;
}
tick_height = xlab_height / 2 ;
}
else {
tick_height = rect.bottom / 64 + 2 ;
font = NULL ;
}
/*
Last check on label display. Are X-axis labels to wide?
*/
if ((xlab_width * xnticks) > (3 * rect.right / 4)) {
//.........这里部分代码省略.........