二、Windows图形处理—设备内容(设备内容属性)
前面已经提到过,Windows使用设备内容来保存控制GDI函数在显示器上如何操作的「属性」。例如,在用TextOut函数显示文字时,程序写作者不必指定文字的色彩和字体,Windows从设备内容取得这个信息。
程序取得一个设备内容的句柄时,Windows用默认值设定所有的属性(在下一节会看到如何取代这种设定)。表5-1列出了Windows 98支持的设备内容属性,程序可以改变或者取得任何一种属性。
	
		
	 
	
		
	 
		
		
	程序取得一个设备内容的句柄时,Windows用默认值设定所有的属性(在下一节会看到如何取代这种设定)。表5-1列出了Windows 98支持的设备内容属性,程序可以改变或者取得任何一种属性。
| 表5-1 | 
| 设备内容属性 | 默认值 | 修改该值的函数 | 取得该值的函数 | 
| Mapping Mode | MM_TEXT | SetMapMode | GetMapMode | 
| Window Origin | (0, 0) | 
				SetWindowOrgEx OffsetWindowOrgEx  | 
			GetWindowOrgEx | 
| Viewport Origin | (0, 0) | 
				SetViewportOrgEx OffsetViewportOrgEx  | 
			GetViewportOrgEx | 
| Window Extents | (1, 1) | 
				SetWindowExtEx SetMapMode ScaleWindowExtEx  | 
			GetWindowExtEx | 
| Viewport Extents | (1, 1) | 
				SetViewportExtEx SetMapMode ScaleViewportExtEx  | 
			GetViewportExtEx | 
| Pen | BLACK_PEN | SelectObject | SelectObject | 
| Brush | WHITE_BRUSH | SelectObject | SelectObject | 
| Font | SYSTEM_FONT | SelectObject | SelectObject | 
| Bitmap | None | SelectObject | SelectObject | 
| Current Position | (0, 0) | 
				MoveToEx LineTo PolylineTo PolyBezierTo  | 
			GetCurrentPositionEx | 
| Background Mode | OPAQUE | SetBkMode | GetBkMode | 
| Background Color | White | SetBkColor | GetBkColor | 
| Text Color | Black | SetTextColor | GetTextColor | 
| Drawing Mode | R2_COPYPEN | SetROP2 | GetROP2 | 
| Stretching Mode | BLACKONWHITE | SetStretchBltMode | GetStretchBltMode | 
| Polygon Fill Mode | ALTERNATE | SetPolyFillMode | GetPolyFillMode | 
| Intercharacter Spacing | 0 | SetTextCharacterExtra | GetTextCharacterExtra | 
| Brush Origin | (0, 0) | SetBrushOrgEx | GetBrushOrgEx | 
| Clipping Region | None | 
				SelectObject SelectClipRgn IntersectClipRgn OffsetClipRgn ExcludeClipRect SelectClipPath  | 
			GetClipBox | 
