Results 1 to 4 of 4

Thread: how display picture on MDI form

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    5

    how display picture on MDI form

    please help
    i have a MDI form and i display a picture on that if i put a picture box on form and set imge or backgroundimage porprety of picture box then picture box show picture at design time but when i run project no picture show on MDI form. how can i display picture on MDI form at run time

  2. #2
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    Re: how display picture on MDI form

    Have you included the picture in you're project ?

    Parksie

  3. #3
    Frenzied Member maged's Avatar
    Join Date
    Nov 2002
    Location
    Egypt
    Posts
    1,040

    Re: how display picture on MDI form

    first of all welcome to the forums ??

    second thing, you should never double post on the forum, only post bump in the same thread and it will just up again.

    third thing : regarding your problem,

    when you set any form to be a mdi parent form, in run time it creates an object like a desktop that will host the child forms. (that is why when you run the project after setting the mdiparent form itself with a picture, the picture flashes out and then get covered by a gray layer).


    when drawing or assigning pictures to mdi parent form,u should assign the picture or the drawing to the mdi desktop layer and not the form it self , how to do this ? check the vb code below, make sure to put it inside the mdi parent form

    VB Code:
    1. 'on the form level declare a variable to hold the mdi desktop object
    2. Private WithEvents MDLCTL As New MdiClient
    3.  
    4. 'on the form load event, you need to hook up with the mdi client object ,
    5.         'hooking up with the mdiclient of the parent ro draw anything
    6.         For Each Ctl as control In Me.Controls
    7.             If TypeOf Ctl Is MdiClient Then
    8.                 MDLCTL = Ctl
    9.                 Exit For
    10.             End If
    11.         Next
    12.         Ctl = Nothing
    13. 'now you can assign pictures or drawing to mdlctl object to see it on form
    14. by overriding the paint event for the mdlctl you defined and loaded in the start

    this is the theory, adjust it to your needs

    rgds

  4. #4
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: how display picture on MDI form

    I had done an example for someone about a month or so ago..

    http://www.vbforums.com/showthread.p...ight=image+mdi

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