CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2001
    Location
    Rhode Island
    Posts
    56

    Fixed Size MDIform

    I am trying to set the MDIForm so that it cannot be resized by the user, but cannot seem to find the property to do this. I am able to fix the child within the MDIForm, but cannot fix the MDIForm itself. Anybody have the answer??

    Thanks,
    Ron


  2. #2
    Join Date
    Jan 2000
    Location
    MO, USA
    Posts
    1,506

    Re: Fixed Size MDIform

    I think you might have to use the Form's Resize event and just force the size to be whatever you want it be.

    'set the values to be whatever the forms size should be

    private Sub MDIForm_Resize()
    me.Height = 6270
    me.Width = 8055
    End Sub




    this surely, isn't the best solution because the form flickers when you try to resize it, but it stops the user resizing the form.

    if i think of another way (with API probably), i'll let you know,

    john

    John Pirkey
    MCSD
    http://www.ShallowWaterSystems.com
    http://www.stlvbug.org
    John Pirkey
    MCSD (VB6)
    http://www.stlvbug.org

  3. #3
    Join Date
    Mar 2001
    Location
    Rhode Island
    Posts
    56

    Re: Fixed Size MDIform

    Thanks - I was hoping there was some parameter that could be set... That is kind of odd that there isn't. The MDIForm expands, but the child does not expand with it... I guess it would be okay if they expanded together. Do you know if there is a way to do that? They only thing that I am really using the MDIForm for is the menu bar. I would have to repeat the menus in every form if I did not do that...

    Thanks a lot,
    Ron


  4. #4
    Join Date
    Jan 2000
    Location
    MO, USA
    Posts
    1,506

    Re: Fixed Size MDIform

    you could write code, again, in the MDIForm_Resize() event to "scale" the child form's size to be whatever you wanted. you'll have to play around with it, it can be alittle tricky.

    as for duplicating the menus, unfortunately, there's no really easy way of doing this. you could probably use the VB6 Template Manager Add-In with your own custom menu template item. go to Add-Ins menu, then Add-In Manager and select the VB6 template Manager. then open it up and away you go. before you do this, you'll have to build a new form with the menu you want to copy across the other forms and save it in the Templates\Menus directory under the VB98 directory (or whereever you installed VB at).

    hope this helps,

    john

    John Pirkey
    MCSD
    http://www.ShallowWaterSystems.com
    http://www.stlvbug.org
    John Pirkey
    MCSD (VB6)
    http://www.stlvbug.org

  5. #5
    Join Date
    Mar 1999
    Location
    Nepal
    Posts
    540

    Re: Fixed Size MDIform

    If you have finalised your menu structure, you can copy it in multiple forms as follows:

    Create the menu structure in one form.

    Open it in a text editor

    Copy the code relevant to the menu. For example, I copied the following code


    Begin VB.Menu mnuFile
    Caption = "&File"
    Begin VB.Menu mnuFileNew
    Caption = "&new"
    End
    Begin VB.Menu mnuFileOpen
    Caption = "&Open"
    End
    Begin VB.Menu mnuFileExit
    Caption = "&Exit"
    End
    End
    Begin VB.Menu mnuEdit
    Caption = "&Edit"
    Begin VB.Menu mnuEditCopy
    Caption = "&Copy"
    End
    Begin VB.Menu mnuEditPaste
    Caption = "&Paste"
    End
    End




    from one form and pasted it into another, in the corresponding location in Form2. And the same menu appears in another form.

    For the Event Handlers of the menu, you can do the actual code in a module and call the functions from the form. Or make the event handlers of one form public and call them from the other forms.


  6. #6
    Join Date
    Mar 2001
    Location
    Rhode Island
    Posts
    56

    Re: Fixed Size MDIform

    Johnny and shree.. thanks a lot. I will look at my options now and go from here.


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

Featured