Results 1 to 8 of 8

Thread: [2005] Maximising Problem

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2007
    Posts
    362

    Question [2005] Maximising Problem

    If have more than one childform in the Parent form, and i maximize one child form then the remaining child forms also gets maximized automatically. How can i prevent this to happen ?

  2. #2
    Frenzied Member
    Join Date
    Jan 2001
    Posts
    1,374

    Re: [2005] Maximising Problem

    Put this into the Form's Activated event handler:

    Code:
    Me.WindowState = FormWindowState.Normal

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Maximising Problem

    That's how MDI works. That's how it's supposed to work and that's how it always works. If one child is maximised then they all are. If one isn't then none of them are.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2007
    Posts
    362

    Re: [2005] Maximising Problem

    JMC, Is there anyway this can be avoided ?

  5. #5
    Frenzied Member
    Join Date
    Jan 2001
    Posts
    1,374

    Re: [2005] Maximising Problem

    I recently had the opposite problem - the first MDI child was in its normal window state despite its "WindowState" property being set to "Maximized" at design time. Subsequent MDI forms are maximised even if the "WindowState" property is set to "Normal" at design time.

    To alter this behaviour, the "WindowState" property of the MDI child must be set at runtime in either the form's load or activated event procedure depending on which outcome you are trying to achieve.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2007
    Posts
    362

    Re: [2005] Maximising Problem

    i have set the windowstate property of my mdi child to normal in the load event. But still i'm facing this problem.

  7. #7
    Frenzied Member
    Join Date
    Jan 2001
    Posts
    1,374

    Re: [2005] Maximising Problem

    Quote Originally Posted by robertx
    Put this into the Form's Activated event handler:

    Code:
    Me.WindowState = FormWindowState.Normal
    It needs to go into the MDI Child Form's Activated event handler - see Post #2 above.

    To always make the MDI child's window state normal:
    Code:
    Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
         Me.WindowState = FormWindowState.Normal
    End Sub
    To always make the MDI child's window state maximised:
    Code:
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Me.WindowState = FormWindowState.Maximized
    End Sub

  8. #8
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: [2005] Maximising Problem

    could always use the Resize event with this code:

    If Me.WindowState = WindowState.Maximized Then Me.WindowState = WindowState.Normal
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

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