版主你好,麻烦你给看一下呗,为什么最终pic2里什么都没有谢谢
Dim Bru As Long '刷子句柄
Dim WDC As Long 'pic1句柄
Dim picBits() As Byte
Dim picInfoD As BITMAP
Dim bytesperpixel As Integer
dim SPN as integerPrivate Sub Form_Load()
    Pic2.Width = Pic1.Width
    Pic2.Height = Pic1.Height
End Sub
'注: 图片框scalemode设置为pixel
Private Sub Pic1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Pic1.DrawMode = 13
    If SPN = 0 Then
        SPN = 1
        ReDim Preserve PTS(1 To 2)
        PTS(1).X = X
        PTS(1).Y = Y
    ElseIf SPN = 1 Then
        SPN = 2
        PTS(2).X = X
        PTS(2).Y = Y
    Else
        SPN = 3
        Pic1.DrawMode = 13
        WDC = GetDC(Pic1.hwnd)
        Bru = CreateSolidBrush(vbBlack)
        ReDim Preserve PTS(1 To 3)
        PTS(3).X = X
        PTS(3).Y = Y
        hRgn = CreatePolygonRgn(PTS(1), 3, 1)
        FillRgn WDC, hRgn, Bru
        DeleteObject hRgn
        DeleteObject Bru
        
        With Pic1
            GetObject .Image, Len(picInfoD), picInfoD
            bytesperpixel = picInfoD.bmBitsPixel \ 8
            ReDim picBits(1 To picInfoD.bmWidth * picInfoD.bmHeight * bytesperpixel)            GetBitmapBits .Image, UBound(picBits), picBits(1)
        End With
        
        GetBitmapBits Pic1.Image, UBound(picBits), picBits(1)
        SetBitmapBits Pic2.Image, UBound(picBits), picBits(1)
    End If
End Sub