Results 1 to 12 of 12

Thread: this is wierd........

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298

    Question

    Hi,

    My app has an MDIForm which has a PictureBox and an Image control on the Picturebox. How do I load a childform over this MDIForm?? When I use

    Load Childform

    only the titlebar of my app changes, but the childform is not visible.

    If I change the MDIChild property to false then the form is visible. But I need the form to be a childform.

    Any ideas????

    Thanx in advance.

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Smile

    This surely is weird because it works on my computer. Maybe you just have some problems with the form properties:
    1. Is it visible?
    2. Is it in the correct position? HAve you anything that moves your childform before it loads or in its load event.

    You can post some of you code if the problems persist and i'll have a look at it.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298

    kedaman...........

    Hi kedaman,


    This is the code I've used:

    In the MDIForm Load event:
    --------------------------

    Image1.Picture = LoadPicture("C:\windows\setup.bmp")
    Set Env = rdoEngine.rdoEnvironments(0)
    Set cn = Env.OpenConnection("User", rdDriverNoPrompt, ,"ODBC;Database=User;UID=admin;PWD=password;DSN=User")

    FrmLogin.Show


    In FrmLogin's load event:
    -------------------------

    Dim Ret1 As Long
    Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2
    Set Users = cn.OpenResultset("select * from user order by userid", rdOpenDynamic)
    LblQues.Caption = Question_Gen
    If ReLogin Then

    'To disable Ctrl+Alt+Del
    Ret1 = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, plod, 0)

    End If

    Users --> resultset
    ReLogin --> Boolean variable
    Question_Gen --> Is a function to randomly generate(?) a caption for the label control.

    -----------------------------------------------------------

    Any ideas???

    Thanx again.

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Well i think that wont tell me much, if you don't post the event where you're loading the mdichild

    And also, how on earth are you suppose to load and image in the mdiform?!??
    I don't think any controls can be placed on the mdiform, maybe you're mixing it up with the child.

    But hey, don't start crying now, im sure I can fix this, if you only give me your whole project to look at.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    Do you mean you have placed a picturebox on the mdi parent form? If this picturebox is large, there won't be much workspace left for other forms. And if it covers the entire workspace, this would explain why you don't see the childforms. If you just want to put a background picture at the parents workspace, use the picture property.

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Ah, i see. I didn't know about this placing pictures on a mdiform. Sorry about that. I think Frans C got the solution
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298

    Frans C.....

    yup, Frans C. I've placed a picturebox and then an image control on the picture box. The reason I've done that and not used the picture property of the MDIFrom itself, is that the MDIForm does not have a Stretch property, which an image control does. (The picture box doesn't have that property as well). Is there any other way out??? Other than not making the form a child form(which I have to do!!!)???? Coz the form which has to be a child form is a registration form for the user and I need it to be a child form. Any ideas????

    Thanks again!


  8. #8
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I have a solution for that,
    1. make the picturebox invisible, and remove the image
    2. load the picture into the picturebox on the mdi instead.
    3. use paintpicture method to stetch it to the size of the mdiform (you should resize the picturebox too)
    4. set the mdiforms picture property to the picturebox

    If you're not familiar with paintpicture, the vb help should explain well
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298

    kedaman........

    All that u said works fine....well, almost.....Im unable to resize the picturebox.....what I did was try to set the width and height properties in the Load event of the mdiform....but that didnt quite work.

    My code:

    MDIForm1.WindowState = vbMaximized
    Set Picture1.Picture = LoadPicture("D:\wannabrowse\bground.jpg")
    Picture1.PaintPicture Picture1.Picture, 0, 0, MDIForm1.Width, MDIForm1.Height
    Picture1.Width = MDIForm1.Width
    Picture1.Height = MDIForm1.Height
    MDIForm1.Picture = Picture1.Picture
    Form1.Show


    Ive set the mdichild property of form1 to true.

    The only problem is that the picture size is not set to the mdiform size. How do I resize the picturebox???

    Thanks.

  10. #10
    Addicted Member
    Join Date
    Mar 2000
    Location
    Gainesville, FL
    Posts
    131
    put that code in the form_resize event.

  11. #11

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298

    Raydr..........and anyone else whos' got an idea.....

    Raydr,

    I tries putting the code in the resize event of the MDIform, but it still doesn't work. The child form loads, but the picture on the main form doesnn't cover the entire form.

    My code:

    Private Sub MDIForm_Resize()
    Picture1.Picture = LoadPicture("C:\windows\setup.bmp")
    Picture1.PaintPicture Picture1.Picture, 0, 0, Screen.Width, Screen.Height
    MDIForm1.Picture = Picture1.Picture
    Picture1.Height = MDIForm1.Height
    Form1.Show
    End Sub

    Any idea on how I can get this to work???

    Thanks again.


  12. #12
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Ok, Rammy, you need to put that picturebox into another form, and then do the resizing and paintpicturing there, and after that import it to your mdiparent. And also you should set the picturebox picture property to nothing after that.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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