扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
Public Sub DibGet(ByVal IdSource As Long, XBegin As Long, ByVal YBegin As Long, ByVal XEnd As Long, ByVal YEnd As Long) Dim iBitmap As Long Dim iDC As Long Dim I As LongDim Dim W As Long Dim H As Long On Error GoTo ErrLine Done = False TimeGet = timeGetTime InPutWid = XEnd - XBegin InPutHei = YEnd - YBegin W = InPutWid + 1 H = InPutHei + 1 I = (Bits \ 8) - 1 ReDim ColVal(I, InPutWid, InPutHei) With bi24BitInfo.bmiHeader .biBitCount = Bits .biCompression = 0& .biPlanes = 1 .biSize = Len(bi24BitInfo.bmiHeader) .biWidth = W .biHeight = H End With iBitmap = GetCurrentObject(IdSource, 7&) GetDIBits IdSource, iBitmap, 0&, H, ColVal(0, 0, 0), bi24BitInfo, 0& DeleteObject iBitmap Done = True TimeGet = timeGetTime - TimeGetExit Sub ErrLine: MsgBox "错误号:" & Err.Number & ":" & Err.Description End Sub |
Public Sub DIBPut(ByVal IdDestination As Long) Dim W As Long Dim H As Long On Error GoTo ErrLine Done = False TimePut = timeGetTime W = OutPutWid + 1 H = OutPutHei + 1 With bi24BitInfo.bmiHeader .biWidth = W .biHeight = H LineBytes = ((W * Bits + 31) And &HFFFFFFE0) \ 8 .biSizeImage = LineBytes * H End With SetDIBitsToDevice IdDestination, 0, 0, W, H, 0, 0, 0, H, ColOut(0, 0, 0), bi24BitInfo.bmiHeader, 0 Done = True TimePut = timeGetTime - TimePut Exit Sub ErrLine: MsgBox Err.Description End Sub |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。