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!

How to TILE a small picture to entire image area

Status
Not open for further replies.

zjlu2715

Programmer
Apr 5, 2002
23
0
0
US
I don't seem to find a TILE function in VB to repeat a small picture to make out for the entire background (such as building a form). Does anyone know how to do it in VB 6.0?

 
Here is a piece of code that will do it.
You need to load the small pic into a picture opject such as a image or picturebox before calling this function.
Also, cleanup the image or picturebox after this funtion.





Public Function TileObject(ByVal stdPct As Object, ByVal objTo As Object, wid As Single, hgt As Single)
On Error Resume Next

Dim x As Single
Dim y As Single

y = 0
Do While y < objTo.Height
x = 0
Do While x < objTo.Width
objTo.PaintPicture stdPct.Picture, x, y, wid, hgt
x = x + wid
Loop
y = y + hgt
Loop

End Function
 
Thanks for the tip. PaintPicture! That's great. It seems to me the duplicated pictures should not take up additional resources like objects since they are simple bitmaps. Is the overhead in placing them on form an issue (or in another word, how much performance & resources we commit to painting them in real time versus loading a full size picture that was pre-tiled into one file)?

Jason
 
Haysie,

I checked the blackbelt MDI package. It works and is a very good example to learn image programming with VB & API. Right now, it's a bit over me. Thanks for the link.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top