Results 1 to 5 of 5

Thread: Resize Event in a MDI Form

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Germany
    Posts
    84
    Hi there,

    got another problem ...

    I have an MDI application
    on the left side of the MDI-Form I placed a picturebox.
    I added a TreeView to it, to display items(records) for navigation
    Now, what I what is to resize that TreeView in the MDIForm_Resize Event so that the TreeView is always 80% the height of the picture box

    Well, making the form larger or smaller isn't the problem - there it works. However when I maximize the form it doesn't.

    I added a few debug.print to the code to get the size of the MDIform and the PictureBox after maximizing:

    After the form was maximized the PictureBox still had the height it had before, when I minimized the form to normal again, the PictureBox had now the height it should actually have when the form was maximized ...

    Would appreciate any tips ...

    Thanx

    Nina
    (Germany)


    Code:
    Option Explicit
    Public KategorienRS As New ADODB.Recordset
    Dim nodX As Node
    
    Private Sub MDIForm_Load()
       SetTVBackColour &HC0C0C0 'Set Backcolor Treeview
       TV1.Top = 0
       TV1.Height = 0.8 * Picture1.Height
       Kategorien_Anzeigen 'Shows Items in Treeview
    End Sub
    
    Private Sub MDIForm_Resize()
       TV1.Top = 0
       TV1.Height = 0.8 * Picture1.Height
    End Sub
    
    'etc.
    [Edited by Nina on 03-23-2000 at 08:11 AM]

  2. #2
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658

    Re: Resize

    In the resize event of the mdi form use the following

    form1.height = me.height * .8

    this will always keep the form at 80% of the height

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Germany
    Posts
    84
    Well, as you can see from the code I added, that's about what I did ...
    But the code doesn't work when the form is maximized

  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    The problem is that the Resize event is fired before the picture box is resized within the MDI form.

    The solution is to use the ScaleHeight property of the MDI form instead of the height property of the picture box.
    Code:
    Private Sub MDIForm_Resize()
       TV1.Top = 0
       TV1.Height = 0.8 * Me.ScaleHeight
    End Sub
    Good luck!

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Germany
    Posts
    84
    Thanx a lot for your help ...

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