 |
|
 |
sal21 Level: Protégé
 Registered: 13-06-2006 Posts: 4
|
newbie....
I have downloaded this code from this site
Public Const SRCCOPY = &HCC0020
Public 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
' REGION
Public Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Public Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
Public Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Public Const RGN_OR = 2
' DEVICE MANIPULATION
Public Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Public Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Public Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
' IMAGE CREATION
Public Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Public Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
' IMAGE MANIPULATION
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
' OBJECTS MANIPULATION
Public Declare Function GetCurrentObject& Lib "gdi32" (ByVal hdc As Long, ByVal ObjTypenCount As Long)
Public Declare Function GetObjectAPI Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
' DRAwING COMMANDS
Public Declare Function Rectangle Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Public Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Public dc As Long
Public rgn As Long
Public Function RegionFromBitmap(ByVal hdc As Long, Optional lBackColor As Long) As Long
Dim lReturn As Long
Dim lRgnTmp As Long
Dim lSkinRgn As Long
Dim lStart As Long
Dim lRow As Long
Dim lCol As Long
Dim tBMP As BITMAP
cBit = GetCurrentObject(hdc, 7)
If cBit Then
GetObjectAPI cBit, Len(tBMP), tBMP
bmpWidth = tBMP.bmWidth
bmpHeight = tBMP.bmHeight
lSkinRgn = CreateRectRgn(0, 0, 0, 0)
glHeight = bmpHeight / Screen.TwipsPerPixelY
glWidth = bmpWidth / Screen.TwipsPerPixelX
If lBackColor < 1 Then lBackColor = GetPixel(hdc, 0, 0)
For lRow = 0 To glHeight - 1
lCol = 0
Do While lCol < glWidth
Do While lCol < glWidth And GetPixel(hdc, lCol, lRow) = lBackColor
lCol = lCol + 1
Loop
If lCol < glWidth Then
lStart = lCol + 2
Do While lCol < glWidth And GetPixel(hdc, lCol, lRow) <> lBackColor
lCol = lCol + 1
Loop
If lCol > glWidth Then lCol = glWidth
lRgnTmp = CreateRectRgn(lStart, lRow + 1, lCol, lRow + 2)
lReturn = CombineRgn(lSkinRgn, lSkinRgn, lRgnTmp, RGN_OR)
Call DeleteObject(lRgnTmp)
End If
Loop
Next
RegionFromBitmap = lSkinRgn
End If
End Function
Public Function SetShape(TheForm As Form, ThePicture As PictureBox, PicturePath As String)
'User Must set the CONTROLBOX property of the form to FALSE
'and theBorderStyle property to "0 - None"
With TheForm
.Appearance = 0
.ClipControls = False
.ScaleMode = 1
End With
With ThePicture
.Appearance = 0
.AutoRedraw = True
.AutoSize = True
.BorderStyle = 0
.ScaleMode = 1
.ScaleLeft = 0
.ScaleTop = 0
End With
ThePicture.Picture = LoadPicture(PicturePath)
TheForm.Width = ThePicture.ScaleWidth
TheForm.Height = ThePicture.ScaleHeight
dc = CreateCompatibleDC(ThePicture.hdc)
Bit = CreateCompatibleBitmap(ThePicture.hdc, ThePicture.ScaleWidth, ThePicture.ScaleHeight)
Call SelectObject(dc, Bit)
Call BitBlt(dc, 0, 0, ThePicture.ScaleWidth, ThePicture.ScaleHeight, ThePicture.hdc, 0, 0, SRCCOPY)
rgn = RegionFromBitmap(dc)
Call SetWindowRgn(TheForm.hwnd, rgn, True)
Call DeleteObject(rgn)
Call DeleteObject(dc)
Call DeleteObject(Bit)
End Function
|
but not understand the correct funcionlity...
Help me with a xls file please.
Tks.
____________________________
Sal
|
|
13-06-2006 at 01:45 PM |
|
|
humberto Level: VB Lord
 Registered: 13-01-2005 Posts: 246
|
Re: newbie....
do Microsoft Office Excel have a thumbnails..?
|
|
13-06-2006 at 01:54 PM |
|
|
|
|
 |
 |