Results 1 to 3 of 3

Thread: Tile An Icon Across A Form

  1. #1

    Thread Starter
    Frenzied Member SeanK's Avatar
    Join Date
    May 2002
    Location
    Boston MA
    Posts
    1,160

    Tile An Icon Across A Form

    I have a really cool Icon that is in an image control.

    Is it possible to tile that one image across my entire form?

  2. #2
    Frenzied Member moinkhan's Avatar
    Join Date
    Jun 2000
    Location
    Karachi, Pakistan
    Posts
    2,011
    Yes! Create the control array of image control and then position each element accordingly...
    I can give u a hint
    VB Code:
    1. Dim xCount As Long
    2. Dim yCount As Long
    3. Dim imgIndex As Long
    4. Private Sub Form_Load()
    5. xCount = Me.Width\Image1(0).Width + 1
    6. yCount = Me.Height\Image1(0).Height +1
    7. ImgIndex = 1
    8. For Y = 1 To yCount
    9.    For X = 1 To xCount
    10.       Load Image1(imgIndex)
    11.            'Here you position them accordingly
    12.    Next X
    13. Next Y
    14. End Sub

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Or, you could use just one image control, and then have your way with it

    VB Code:
    1. Private Sub Form_Load()
    2.    Dim tx As Integer
    3.    Dim ty As Integer
    4.    Dim tw As Integer
    5.    Dim th As Integer
    6.    Dim pw As Long
    7.    Dim ph As Long
    8.    Form1.AutoRedraw = True
    9.    tw = Int(Form1.Width / Image1.Width) + 1
    10.    th = Int(Form1.Height / Image1.Height) + 1
    11.    pw = Image1.Width
    12.    ph = Image1.Height
    13.  
    14.    For tx = 0 To tw
    15.       For ty = 0 To th
    16.          Form1.PaintPicture Image1.Picture, tx * pw, ty * ph
    17.       Next
    18.    Next
    19.  
    20.    Form1.AutoRedraw = False
    21.    Image1.Visible = False
    22. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width