Results 1 to 8 of 8

Thread: MDI Form Size and Other Issues...

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2006
    Posts
    139

    Unhappy MDI Form Size and Other Issues...

    I have a Main MDI and rest forms are child MDI

    Now I have to do the following.. Please help on that :

    1) All the MDI Child SHOULD NOT HAVE the minimize, maximize and close button which is on the top right corner of every SDI form.. so that he cannot close the child forms via that..

    2) When the MDI opens and loads any MDI child in it, the Size of the Child MDI is small , so the full size does not show.. What I want is that the Parent MDI and child MDI auto resize themself so that the full form shows whenever diff child MDI are opened..

    3) How do u code an Msg Box in the Parent MDI close ( X ) Button on top right so that a msgbox opens confirming exit of the program before closing it..

    4) I have a Menu Made in Parent MDI.. Whenever a person clicks on a option there to open a form.. It should close the currently or all loaded child forms and load that particular form.. i.e. i don't want more than 1 child form open at any given time..

    These queries are enough for right now.. so help guys..
    Last edited by khandu; Jan 14th, 2007 at 08:32 AM.

  2. #2
    Fanatic Member
    Join Date
    Sep 2006
    Location
    London, UK
    Posts
    817

    Re: MDI Form Size and Other Issues...

    Here's a start on a couple of your questions.

    2)
    MDIFormName.width = 50000
    MDIFormName.height = 80000

    MDIFormName.Activeform.width = 50000
    MDIFormName.Activeform.height = 80000

    3)
    VB Code:
    1. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    2.     Select Case MsgBox("Exit Program ?", vbYesNo)
    3.         Case vbYes
    4.           Exit
    5.         Case vbNo
    6.           Exit Sub
    7.         End Select
    8. End Sub

    4)
    Unload Me (unloads the active form)
    Form1.show (shows another form)
    Last edited by sgrya1; Jan 14th, 2007 at 10:52 AM.

  3. #3
    Fanatic Member
    Join Date
    Sep 2006
    Location
    London, UK
    Posts
    817

    Re: MDI Form Size and Other Issues...

    1)
    Set the MaxButton and MinButton properties of your MDIchild to False. Not sure about the close button.

  4. #4
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: MDI Form Size and Other Issues...

    1) set the ControlBox property to False at design time.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Dec 2006
    Posts
    139

    Re: MDI Form Size and Other Issues...

    Quote Originally Posted by sgrya1
    Here's a start on a couple of your questions.

    2)
    MDIFormName.width = 50000
    MDIFormName.height = 80000

    MDIFormName.Activeform.width = 50000
    MDIFormName.Activeform.height = 80000
    Does this code have to be only in parent MDI or all forms?? or in declaration module??

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Dec 2006
    Posts
    139

    Re: MDI Form Size and Other Issues...

    VB Code:
    1. MDIFormName.Activeform.width = 50000
    2. MDIFormName.Activeform.height = 80000

    gives an error

    "Object variable or With Block variable not set"

    please help.. i have changed the mdiformname to my name..

    that code maximizes the mdiform .. and i need all active form inside it to be in middle of it but not maximized .. a decent size.. but ALWAYS in center

  7. #7
    Fanatic Member
    Join Date
    Sep 2006
    Location
    London, UK
    Posts
    817

    Re: MDI Form Size and Other Issues...

    You can put it in the Form_Load events of your forms.
    The values of 50000 and 80000 are numbers that you will have to change until you get the right size. Using Me and putting the resize code in the right place will get rid of your error.

    Your MDI form:

    VB Code:
    1. Private Sub MDIForm_Load()
    2. Me.width = 50000
    3. Me.height = 80000
    4. end sub

    Your Child Form:

    VB Code:
    1. Private Sub Form_Load()
    2. Me.width = 50000
    3. Me.height = 80000
    4. ' Center Form In Middle Of MDIform
    5. Me.Move (MDIformname.ScaleWidth / 2) - (Me.Width / 2), (MDIformname.ScaleHeight / 2) - (Me.Height / 2)
    6. end sub
    Last edited by sgrya1; Jan 14th, 2007 at 06:46 PM.

  8. #8
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: MDI Form Size and Other Issues...

    VB Code:
    1. Private Sub MDIForm_Load()
    2.  
    3. frmMDIChild.Show
    4. frmMDIChild.Left = (Me.ScaleWidth - frmMDIChild.Width) / 2
    5. frmMDIChild.Top = (Me.ScaleHeight - frmMDIChild.Height) / 2
    6.  
    7. 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