- Visual C++源码
- Visual Basic源码
- C++ Builder源码
- Java源码
- Delphi源码
- C/C++源码
- PHP源码
- Perl源码
- Python源码
- Asm源码
- Pascal源码
- Borland C++源码
- Others源码
- SQL源码
- VBScript源码
- JavaScript源码
- ASP/ASPX源码
- C#源码
- Flash/ActionScript源码
- matlab源码
- PowerBuilder源码
- LabView源码
- Flex源码
- MathCAD源码
- VBA源码
- IDL源码
- Lisp/Scheme源码
- VHDL源码
- Objective-C源码
- Fortran源码
- tcl/tk源码
- QT源码
shaderect.txt
资源名称:shaderect.zip [点击查看]
上传用户:topsoptop
上传日期:2007-01-03
资源大小:1k
文件大小:1k
源码类别:
图形图像处理
开发平台:
Visual C++
- void ShadeRect( CDC *pDC, CRect& rect )
- {
- // Bit pattern for a monochrome brush with every
- // other pixel turned off
- WORD Bits[8] = { 0x0055, 0x00aa, 0x0055, 0x00aa,
- 0x0055, 0x00aa, 0x0055, 0x00aa };
- CBitmap bmBrush;
- CBrush brush;
- // Need a monochrome pattern bitmap
- bmBrush.CreateBitmap( 8, 8, 1, 1, &Bits );
- // Create the pattern brush
- brush.CreatePatternBrush( &bmBrush );
- CBrush *pOldBrush = pDC->SelectObject( &brush );
- // Turn every other pixel to black
- COLORREF clrBk = pDC->SetBkColor( RGB(255,255,255) );
- COLORREF clrText = pDC->SetTextColor( RGB(0,0,0) );
- // 0x00A000C9 is the ROP code to AND the brush with the destination
- pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(),
- (DWORD)0x00A000C9); //DPa - raster code
- pDC->SetBkColor( RGB(0,0,0) );
- pDC->SetTextColor( GetSysColor(COLOR_HIGHLIGHT) );
- // 0x00FA0089 is the ROP code to OR the brush with the destination
- pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(),
- (DWORD)0x00FA0089); //DPo - raster code
- // Restore the device context
- pDC->SelectObject( pOldBrush );
- pDC->SetBkColor( clrBk );
- pDC->SetTextColor( clrText );
- }