• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 293
  • Last Modified:

Tiling an Image on an MDI form

how do i tile an image on an mdi form. i can tile them on regular forms but mdi forms don't have the place picture property. how do i do it?
0
hess
Asked:
hess
1 Solution
 
Bob LearnedCommented:
You can put a PictureBox on the MDI form.
0
 
hessAuthor Commented:
then the child form won't have a place to be. I want to konw how to tile a picture across the bg of a MDI form
0
 
Bob LearnedCommented:
What version of VB?  I have VB6 and the MDIForm has a Picture property.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
hessAuthor Commented:
it doesn't have  a placepicture... i can put a picture on it but i need to know how to tile a small picture across it...vb 6
0
 
Bob LearnedCommented:
You are losing me, because my MDIForm has a Picture property, and you said that you know how to tile across a normal form.  

So what is the problem?
0
 
hessAuthor Commented:
but you can't tile on the mdi one cause to do it you need a place picture method on the form you want to do it on and the mdi form has no place picture property.
0
 
Éric MoreauSenior .Net ConsultantCommented:
You simply cannot tile a small bitmap on a MDI form.

Thera are at least 2 workarounds to this:
1 - My prefered one. Use a paint editor, tile your bitmap to cover an entire screen, save it and pur this new big bitmap in the Picture property of your MDI form. So there is no tiling just one big bitmap.

2 - But a child form in which you tile your bitmap and place code to be sure that the user won't close this form.
0
 
hessAuthor Commented:
is there a way to tile the bmp on in a picture box... then set that pictures picture to the mdi form's picture so taht the mdi gets a tiled image?
0
 
Bob LearnedCommented:
Tile the image on a regular form, and then transfer the picture image to the MDIForm Picture property.

Private Sub Background()
   
Dim i           As Long
Dim j           As Long

   
   With Form1
   
      .Width = Width
      .Height = Height
   
      With .picBkImage
     
         For i = 0 To Form1.ScaleWidth Step .Width
             For j = 0 To Form1.ScaleHeight Step .Height
                 Form1.PaintPicture .Picture, i, j, .Width, .Height + 30
             Next j
         Next i
     
      End With
   
    End With
   
    Picture = Form1.Image
   
End Sub

Private Sub MDIForm_Load()

   Background
   
End Sub
0
 
vbmitchCommented:
'MDIForm:The name of the MDI parent form to tile an image onto.
'bkgdtiler: The name of a form that is used to generate the tiled background. Check the rest of the docs for the -required- parameters.
'bkgdfile: The image file to load, With complete path.
'The best place to put the call I find is in the form's Form_Load() event.
'--


Sub TileMDIBkgd(MDIForm As Form, bkgdtiler As Form, bkgdfile As String)


    If bkgdfile = "" Then Exit Sub
    Dim ScWidth%, ScHeight%
    ScWidth% = Screen.Width / Screen.TwipsPerPixelX
    ScHeight% = Screen.Height / Screen.TwipsPerPixelY
    Load bkgdtiler
    bkgdtiler.Height = Screen.Height
    bkgdtiler.Width = Screen.Width
    bkgdtiler.ScaleMode = 3
    bkgdtiler!Picture1.Top = 0
    bkgdtiler!Picture1.Left = 0
    bkgdtiler!Picture1.Picture = LoadPicture(bkgdfile)
    bkgdtiler!Picture1.ScaleMode = 3


    For n% = 0 To ScHeight% Step bkgdtiler!Picture1.ScaleHeight


        For o% = 0 To ScWidth% Step bkgdtiler!Picture1.ScaleWidth
            bkgdtiler.PaintPicture bkgdtiler!Picture1.Picture, o%, n%
        Next o%

    Next n%

    MDIForm.Picture = bkgdtiler.Image
    Unload bkgdtiler
End Sub


0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now