Results 1 to 5 of 5

Thread: [RESOLVED] MDIForm minimize

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2006
    Location
    Jerusalem
    Posts
    39

    Resolved [RESOLVED] MDIForm minimize

    hi

    when I double click on my MDIForm heading it minimizes.. how can I set its default place on the screen after minimizing.

    any help?

    thx in advance ..

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: MDIForm minimize

    Quote Originally Posted by muhannad
    when I double click on my MDIForm heading it minimizes...
    Hmmm... DblClick maximizes the form...


    Quote Originally Posted by muhannad
    ...how can I set its default place on the screen after minimizing...
    When form is minimized it will either be shown in the taskbar (if ShowInTaskbar is set to true) OR (if it's a mdi child) it will appear in bottom left area of the MDI parent form and position is determined by the parent form itself.
    By default VB will generate an error "Form cannot be moved while minimized..." (or so). You may subclass the form but it's pointless.
    You can try doing something like this quick sample for any of your MDI Child forms but user will have a headach to restore it to the original size/position:
    VB Code:
    1. Private Sub Form_Resize()
    2.     If Me.WindowState = vbMinimized Then
    3.         Me.WindowState = vbNormal
    4.         Me.Move 0, 0, 0, 0
    5.     End If
    6. End Sub

  3. #3
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: MDIForm minimize

    Quote Originally Posted by muhannad
    ...how can I set its default place on the screen after minimizing...
    Would this help?
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.     With Me
    5.         .Tag = .Left & ";" & .Top & ";" & .Width & ";" & .Height
    6.     End With
    7. End Sub
    8.  
    9. Private Sub Form_Resize()
    10.     If Me.WindowState = vbMinimized Then
    11.         With Me
    12.             .WindowState = vbNormal
    13.             .Move CSng(Split(.Tag, ";")(0)), CSng(Split(.Tag, ";")(1)), CSng(Split(.Tag, ";")(2)), CSng(Split(.Tag, ";")(3))
    14.         End With
    15.     End If
    16. End Sub
    Of course, the .Tag property musn't be used for anything else in this case.

  4. #4

    Thread Starter
    Member
    Join Date
    Nov 2006
    Location
    Jerusalem
    Posts
    39

    Re: MDIForm minimize

    ooh sorry i didnt minimize as in it appears in the taskbar..

    as my application runs, i set the MDIForm to be maximized by default ( full screen ).

    when i double click its heading it resizes itself and becomes smaller and a big portion becomes not visible. i was enquering about that default position if that makes it any clearer.

    thanx

  5. #5
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: MDIForm minimize

    You may need to set minimum Height/Width:
    VB Code:
    1. Option Explicit
    2.  
    3. Dim iMinWidth As Integer
    4. Dim iMinHeight As Integer
    5.  
    6. Private Sub MDIForm_Load()
    7.     iMinWidth = 12000
    8.     iMinHeight = 8000
    9. End Sub
    10.  
    11. Private Sub MDIForm_Resize()
    12.     If Me.WindowState = vbNormal Then
    13.         If Me.Width < iMinWidth Then Me.Width = iMinWidth
    14.         If Me.Height < iMinHeight Then Me.Height = iMinHeight
    15.     End If
    16. 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