zoukankan      html  css  js  c++  java
  • windows编程之GDI基础--获取设备内容属性(三)

    在设备内容中,会保存设备的属性.比如画线的颜色,字体等等.基本上是下面这张表.程序可以任意更改和取得这些属性的值.

    设备内容属性

    默认值

    修改该值的函数

    取得该值的函数

    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

    在BeginPaint和EndPaint之间可以修改系统默认的属性,但是属性在EndPaint之后会失效.

    若不想让他失效的话.在wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;

    CS_OWNDC风格只影响GetDC和BeginPaint获得的设备内容,不影响其它函数(如GetWindowDC)获得的设备内容。

    不推荐使用这个宏.

    可以使用

    idSaved = SaveDC (hdc) ;
    RestoreDC (hdc, idSaved) ;
    //或者
    SaveDC (hdc) ;
    RestoreDC (hdc, -1) ;
  • 相关阅读:
    fiddler工具窗口功能介绍
    Fiddler导出jmx格式实现方法
    Fiddler抓包时一直请求:http://clients1.google.com:443
    内置函数的使用
    python中操作excel、ddt、config、logging方法
    Pycharm 将代码上传到GitHub
    unittest框架-优化一【变量参数化】
    excel的读取
    ddt数据驱动
    selenium中的js和jquery的相关用法
  • 原文地址:https://www.cnblogs.com/SoulReaper/p/3323350.html
Copyright © 2011-2022 走看看