Results 1 to 9 of 9

Thread: Form Question - is this possible?

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    53

    Question Form Question - is this possible?

    Let me see if I can explain this clearly: I had an app designed to run full screen at 1024x768. Now i'm faced with making it run "windowed" on larger/wider monitors, and i'm noticing (on Windows 7 anyway) that when forms "unload" they fade in and out on top of each other and I want the program to run and go from screen to screen "smooth" the way it did when it was full screen.

    I've seen games do this before, so I know its possible.

    Since the program is complex and uses many different forms, is there a way to make the program operate in a single "window" or container so to speak, as if it were still full screen? There's no animation or anything, just static screens. In other words, loading a form right "into" the existing screen so they don't fade in and out?

  2. #2
    Frenzied Member
    Join Date
    Mar 2009
    Posts
    1,182

    Re: Form Question - is this possible?

    I believe that behavior is set up through the OS in its self. As for "windowing" your application, you could use the MDI Parent/Child setup and probably would not take too much effort on your part to convert your program to such...



    Good Luck
    Option Explicit should not be an Option!

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    53

    Re: Form Question - is this possible?

    So how do I use the MDI Parent/Child setup? Do I load the initial form, then each other form as a Child form?

  4. #4
    Frenzied Member
    Join Date
    Mar 2009
    Posts
    1,182

    Re: Form Question - is this possible?

    Yes, you would load the parent form, a MDIForm, set all your other forms to be children (MDChild = true in properties).

    Now, depending upon your startup and program flow this can be easy or difficult but if you have added the MDIForm and changed the MDIChild property of all the forms then...

    If you startup object is sub main and in sub main you have... say Form1.Show, you would change that to MDIForm1.Show. Then in the load of MDIForm1 you would set Form1.show. However, if your startup object is Form1 then you will need to change that in project properties to the MDIForm1 and in its load put Form1.Show. From there, it should be fairly easy to keep previous functionality without doing much else.


    Good Luck
    Option Explicit should not be an Option!

  5. #5

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    53

    Re: Form Question - is this possible?

    Very close so far...thanks! I'm almost there now.

    One more issue: It loads the very first form fine, but then it loads the next form shifted down and diagonal a bit (cascaded I guess it is)...is there a way to totally unload the previous form so it doesn't shift downward a bit (so they load "on top" of each other, so to speak)?

  6. #6
    Frenzied Member
    Join Date
    Mar 2009
    Posts
    1,182

    Re: Form Question - is this possible?

    Well first off you could make form1's window state vbMaximized and all other forms will be the same...
    Code:
    Load Form1
    Form1.WindowState = vbMaximized
    Form1.Show
    or you could do...
    Code:
    Load Form2
    Form2.Left = Form1.Left
    Form2.Top = Form1.Top
    Form2.Width = Form1.Width
    Form2.Height = Form1.Height
    Form2.Show


    Good Luck
    Option Explicit should not be an Option!

  7. #7

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    53

    Re: Form Question - is this possible?

    Here's a pic of the issue...I figure if there's a way to totally unload the form, I can just load the new one into the MDI Form without it being pushed down.

    The first form here works great:


    But the next form loads and displays like this:


    What do I do to "reset" the next form to display centered in the "window" using MDI? I'm very close to getting what I need....thanks for your help so far.

    Note: Your second suggestion above doesn't work for some reason, and I need the app to be windowed, so maximizing the window won't look right.
    Last edited by derek412; Jan 4th, 2010 at 11:33 PM.

  8. #8

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    53

    Re: Form Question - is this possible?

    Actually: Your second suggestion above does work; is there an easier way though? Something more automatic/compact?

  9. #9
    Frenzied Member
    Join Date
    Mar 2009
    Posts
    1,182

    Re: Form Question - is this possible?

    You could use the move method instead of left/top/height/width arguements which would reduce those four lines down to one. Further more, you could create a public sub that takes a form or forms as an arguement(s)...
    Code:
    Public Sub MoveMyForm(NewForm As Form, OldForm As Form)
    Load NewForm
    NewForm.Move OldForm.Left, OldForm.Top, OldForm.Width, OldForm.Height
    NewForm.Show
    End Sub
    and you would call it like so...
    Code:
    MoveMyForm Form2, Form1


    Good Luck
    Option Explicit should not be an Option!

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