Option Base 1
DefInt A-Q 'a-q integers
DefSng R-Z 'rst, uvw, xyz real
'Copy one array to another of same number of bytes
'Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
'(Destination As Any, Source As Any, ByVal Length As Long)
'------------------------------------------------------------------------------
'Used to extract small bitmap from a large one and show shrunken bitmap
Public Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, _
ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, _
ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Public Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, _
ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, _
ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, _
ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
'To get dimensions of GIF's & JPG's
Declare Function GetObjectAPI Lib "gdi32" Alias "GetObjectA" _
(ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
Type BITMAP
bmType As Long
bmWidth As Long
bmHeight As Long
bmWidthBytes As Long
bmPlanes As Integer
bmBitsPixel As Integer
bmBits As Long
End Type
'Dim bmp As BITMAP
'------------------------------------------------------------------------------
'To move & get cursor postion
Public Declare Sub SetCursorPos Lib "user32" (ByVal IX As Long, ByVal IY As Long)
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
'------------------------------------------------------------------------------
'Windows API - much faster then VB's PSet and Point
Public Declare Function SetPixelV Lib "gdi32" _
(ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As Long
Public Declare Function GetPixel Lib "gdi32" _
(ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long
'------------------------------------------------------------------------------
'Draw polyline
Public Declare Function Polyline Lib "gdi32" (ByVal hdc As Long, _
lpPoint As POINTAPI, ByVal nCount As Long) As Long
Public Type POINTAPI: kX As Long: kY As Long: End Type
'------------------------------------------------------------------------------
'For shading & fill
Public Declare Function CreatePen Lib "gdi32" _
(ByVal nPenStyle As Long, ByVal nWidth As Long, ByVal crColor As Long) As Long
Public Declare Function ExtFloodFill Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, _
ByVal Y As Long, ByVal crColor As Long, ByVal fuFillType As Long) As Long
Public Declare Function CreateBitmap Lib "gdi32" (ByVal nWidth As Long, _
ByVal nHeight As Long, ByVal nPlanes As Long, ByVal nBitCount As Long, lpBits As Any) As Long
Public Declare Function CreatePatternBrush Lib "gdi32" (ByVal hBitmap As Long) As Long
'------------------------------------------------------------------------------
'Selecting pens & clearing up API Objects & Device Contexts
Public Declare Function SelectObject Lib "gdi32" _
(ByVal hdc As Long, ByVal hObject As Long) As Long
Public Declare Function DeleteObject Lib "gdi32" _
(ByVal hObject As Long) As Long
Public Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Public Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, _
ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, _
ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Public Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, _
ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, _
ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, _
ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
form里面写的在picturebox_mouseup是调用
Private Sub CANVASSAVE()
'BitBlt method
hSorcDC& = Picture1.hdc
hDestDC& = picCanvasStore.hdc
dwRop& = &HCC0020 'Src to Dest
SorcX = 0: SorcY = 0
DestX = 0: DestY = 0
nWidth = picCanvasStore.Width
nHight = picCanvasStore.Height
Success& = BitBlt(hDestDC&, DestX, DestY, nWidth, nHight, hSorcDC&, SorcX, SorcY, dwRop&)
End Sub
说hSorcDC&未定义