alexmckey » 24.08.2006 (Чт) 7:41
спасибо за ответ. я так и пытаюсь ,но MyImage=0
Sub CreateMyImage(wdh As Long, hgt As Long)
Dim graph As Long, _
bytes() As Byte, _
BI As BITMAPINFO, MyImage As Long, memdc As Long, membm As Long, oldBitmap As Long
With BI.bmiHeader
.biSize = Len(BI.bmiHeader)
.biBitCount = 32
.biHeight = -hgt
.biWidth = wdh
.biPlanes = 1
.biSizeImage = Abs(.biWidth * .biHeight * 4)
End With
memdc = CreateCompatibleDC(0)
membm = CreateDIBSection(memdc, BI, DIB_RGB_COLORS, ByVal 0, 0, 0)
oldBitmap = SelectObject(memdc, membm)
GdipCreateFromHDC memdc, graph
'рисовние
ReDim bytes(BI.bmiHeader.biSizeImage - 1) As Byte
GetDIBits memdc, membm, 0, -BI.bmiHeader.biHeight, bytes(0), BI, DIB_RGB_COLORS
'манипуляции с битами
SetDIBits memdc, membm, 0, hgt, bytes(0), BI, DIB_RGB_COLORS
GdipCreateBitmapFromGdiDib BI, bytes(0), MyImage
End Sub
mckey