GSerg писал(а):А мы-то думали на асме, раздел-то про асм, хорошо, что пояснил...
Не знаю я как скрестить BitBit и Net (в частности Bitmap)
Private Declare Function BitBlt Lib "gdi32.dll" (ByVal hDestDC As IntPtr, ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hSrcDC As IntPtr, ByVal xSrc As Integer, ByVal ySrc As Integer, ByVal dwRop As Integer) As Integer
Private Declare Function CreateCompatibleBitmap Lib "gdi32.dll" (ByVal hdc As IntPtr, ByVal nWidth As Integer, ByVal nHeight As Integer) As IntPtr
Private Declare Function DeleteObject Lib "gdi32.dll" (ByVal hObject As IntPtr) As Integer
Private Declare Function CreateCompatibleDC Lib "gdi32.dll" (ByVal hdc As IntPtr) As IntPtr
Private Declare Function DeleteDC Lib "gdi32.dll" (ByVal hdc As IntPtr) As Integer
Private Declare Function SelectObject Lib "gdi32.dll" (ByVal hdc As IntPtr, ByVal hObject As IntPtr) As IntPtr
Private Declare Function GetDC Lib "user32.dll" (ByVal hwnd As IntPtr) As IntPtr
Private Declare Function ReleaseDC Lib "user32.dll" (ByVal hwnd As IntPtr, ByVal hdc As IntPtr) As IntPtr
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim hb, hd, hs As IntPtr
hs = GetDC(IntPtr.Zero)
hd = CreateCompatibleDC(hs)
hb = CreateCompatibleBitmap(hs, 1024, 768)
DeleteObject(SelectObject(hd, hb))
BitBlt(hd, 0, 0, 1024, 768, hs, 0, 0, &HCC0020)
ReleaseDC(IntPtr.Zero, hs)
Dim b As Bitmap = Bitmap.FromHbitmap(hb)
b.Save("c:\1.gif", Drawing.Imaging.ImageFormat.Gif)
b.Dispose()
DeleteDC(hd)
DeleteObject(hb)
End Sub
Извиняюсь, но это не всегда для всех очевидно.
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 37