如题

解决方案 »

  1.   

    hbmMask
    Identifies an optional monochrome bitmap that is used to mask the colors of the source rectangle.例子:
    Const BI_RGB = 0
    Const DIB_RGB_COLORS = 0 ' color table in RGBs
    Const DIB_PAL_COLORS = 1 ' color table in palette indices
    Const PATCOPY = &HF00021 ' (DWORD) dest = pattern
    Const PATINVERT = &H5A0049       ' (DWORD) dest = pattern XOR dest
    Const PATPAINT = &HFB0A09        ' (DWORD) dest = DPSnoo
    Private Type POINTAPI
            x As Long
            y As Long
    End Type
    Private Type BITMAPINFOHEADER '40 bytes
            biSize As Long
            biWidth As Long
            biHeight As Long
            biPlanes As Integer
            biBitCount As Integer
            biCompression As Long
            biSizeImage As Long
            biXPelsPerMeter As Long
            biYPelsPerMeter As Long
            biClrUsed As Long
            biClrImportant As Long
    End Type
    Private Type BITMAPINFO
            bmiHeader As BITMAPINFOHEADER
    End Type
    Private Type tBITMAP
        Header As BITMAPINFO
        Bytes(0 To 63) As Byte
    End Type
    Private Declare Function CreateDIBPatternBrushPt Lib "gdi32" (lpPackedDIB As Any, ByVal iUsage As Long) As Long
    Private Declare Function PlgBlt Lib "gdi32" (ByVal hdcDest As Long, lpPoint As POINTAPI, ByVal hdcSrc As Long, ByVal nXSrc As Long, ByVal nYSrc As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hbmMask As Long, ByVal xMask As Long, ByVal yMask As Long) As Long
    Private Declare Function PatBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal dwRop As Long) As Long
    Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
    Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
    Private Sub Form_Paint()    Dim hBrush As Long, tBr As tBITMAP, Cnt As Long, hOld As Long
        Dim Pt(0 To 2) As POINTAPI
        'set the co鰎dinates of the parallelogram
        Pt(0).x = 30
        Pt(0).y = 10
        Pt(1).x = 300
        Pt(1).y = 0
        Pt(2).x = 0
        Pt(2).y = 300
        'resize and modify a screenshot
        PlgBlt Me.hdc, Pt(0), GetDC(0), 0, 0, Screen.Width / Screen.TwipsPerPixelX, Screen.Height / Screen.TwipsPerPixelY, ByVal 0&, ByVal 0&, ByVal 0&
        'initialize the tBITMAP-structure
        With tBr.Header.bmiHeader
            .biSize = Len(tBr.Header.bmiHeader)
            .biCompression = BI_RGB
            .biHeight = 8
            .biPlanes = 1
            .biWidth = 8
            .biBitCount = 1
        End With
        For Cnt = 0 To 7
            tBr.Bytes(Cnt) = 128
        Next Cnt
        'create a pattern brush
        hBrush = CreateDIBPatternBrushPt(tBr, DIB_RGB_COLORS)
        'select the brush into the form's DC
        hOld = SelectObject(Me.hdc, hBrush)
        'Perform the Pattern Block Transfer
        PatBlt Me.hdc, 0, 0, 30, 30, PATCOPY
        'restore the old brush and delete our pattern brush
        DeleteObject SelectObject(Me.hdc, hOld)
    End Sub
    SHANNON
       ----------------
        [email protected]
      

  2.   

    hbmMask 
    Long,
    一个可选的句柄,指向一个单色掩模。如设定了这个参数,那么只有与掩模值1对应的二进制位才会传输到目的地 SHANNON
       ----------------
        [email protected]