Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tile PictureBox Inside PictureBox

Status
Not open for further replies.

MrVB50au

Programmer
Mar 16, 2003
326
0
0
AU
Hi all,
I recently posted a request for help on this matter but while waiting for a response I managed to come up with the solution and here it is.

CONTROLS USED:
Form1
SSPanel1
inside SSPanel1 are:
Picture1 sized to SSPanel1
Picture2 inside Picture1 to tile on Picture1

SOURCE CODE USED:
This code is only for those users who run Win98.
The Alphablending.dll file can be located by searching at yahoo... Simply type: Alphablending.dll and you'll see the search result.

Andrew G.

Option Explicit

Private Declare Function AlphaBlending Lib "Alphablending.dll" (ByVal destHDC As Long, ByVal XDest As Long, ByVal YDest As Long, ByVal destWidth As Long, ByVal destHeight As Long, ByVal srcHDC As Long, ByVal XSrc As Long, ByVal YSrc As Long, ByVal srcWidth As Long, ByVal srcHeight As Long, ByVal AlphaSource As Long) As Long

Private Sub MyAlphaBlend(destObject As PictureBox, srcObject As PictureBox, rows As Integer, col As Integer, depth As Long)
Dim i, j As Integer
Dim myheight, mywidth As Variant 'Width and Height.
'
'Get Picture1.Height, store it in variable 'myheight'.
myheight = srcObject.Height
'
'Get Picture1.Width, store it in variable 'mywidth'.
mywidth = srcObject.Width
'
'Use a nested 'For Loop' to create 8 across, 8 down.
For i = 0 To rows
For j = 0 To col
AlphaBlending destObject.hDC, (i * mywidth), (j * myheight), srcObject.ScaleWidth, srcObject.ScaleHeight, srcObject.hDC, 0, 0, srcObject.ScaleWidth, srcObject.ScaleHeight, depth
Next j
Next i

End Sub

Private Sub Form_Load()
MyAlphaBlend Picture1, Picture2, 4, 4, 100
End Sub

I hope this helps someone looking for a nice background effect. especially if you want to blend a background color of the picture1 (area) with picture2 (tile).
 
And for those who don't want to use a 3rd party control, just use the built-in alphablend API function (which has the advantage it works on W98/Me/2000/XP)
 
As discussed in thread222-510367
 
strongm,

Could you please show me where I can find Alphablend in Win98?

This would be very much appriciated,

Andrew G.
 
thread222-520827 contains my example, somewhere near the bottom of the thread
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top