[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

mdiform resize picture box

Posted on 2002-03-28
5
Medium Priority
?
482 Views
Last Modified: 2008-03-10
hi I am trying to create a slide menu using a picture box on an mdiform. I have managed to make it slide out by simply setting the width property on the mousemove event.

My problem is that if any child forms are visible, as the picture box gets wider it pushes the child forms accross to the right(picture box is aligned left).Is there any way I can stop this from happening and make the picture box slide over the child forms.(the picture box does this automatically if u align it left or bottom but not if it is aligned left?

Thanks
NIep
0
Comment
Question by:NIep2001
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 15

Expert Comment

by:ameba
ID: 6903198
Instead of picturebox, use one mdichild form without border or caption, make it 'On Top', and resize it in MDIForm_Resize()
0
 

Author Comment

by:NIep2001
ID: 6904133
Hey ameba
sounds good but how do I make a child form appear 'on Top'! and make sure that child form always appears on left most  edge of mdiform(sorry if dumb question but first time in such a situation) shot
Niep
0
 
LVL 15

Accepted Solution

by:
ameba earned 400 total points
ID: 6904768
OK, here is the sample (one MDI form and 2 MDIchild forms).

Start new project, Form1 is automatically added.
Form1 - set property: MDIChild=True

Add Form, name it frmMenu:
'---------------------------------------------------------------------------
' frmMenu form (Caption="Menu", MDIChild=True, Moveable=False, BorderStyle=5)
Option Explicit

Private Sub Form_Unload(Cancel As Integer)
    MDIForm1.bMenuVisible = False    ' notify parent form
End Sub
'---------------------------------------------------------------------------

Add MDIForm
'---------------------------------------------------------------------------
' MDIForm1 (AutoShowChildren=False, Scrollbars=False)
' add menu and submenu:
'   mnuView (Caption="&View")
'        mnuVSlideMenu (Caption="&Slide Menu")
Option Explicit
Private Const GWL_HWNDPARENT = (-8)
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
    (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public bMenuVisible As Boolean ' flag

Private Sub MDIForm_Load()
    mnuVSlideMenu_Click     ' show slide menu
End Sub

Private Sub MDIForm_Resize()
    ' move slide menu to the left
    If bMenuVisible Then frmMenu.Move 2 * Screen.TwipsPerPixelX, 2 * Screen.TwipsPerPixelY, _
        frmMenu.Width, Me.ScaleHeight
End Sub

Private Sub mnuView_Click()
    mnuVSlideMenu.Checked = bMenuVisible
End Sub

' show/hide slide menu
Private Sub mnuVSlideMenu_Click()
    bMenuVisible = Not bMenuVisible
    If bMenuVisible Then
        Load frmMenu
        frmMenu.Move 2 * Screen.TwipsPerPixelX, 2 * Screen.TwipsPerPixelY, 1500, Me.ScaleHeight
        SetChild frmMenu
        frmMenu.Show
    Else
        Unload frmMenu
    End If
End Sub

' this will set mdi child form 'on top of other mdi child forms'
Public Sub SetChild(MdiChildForm As Form)
    Call SetWindowLong(MdiChildForm.hwnd, GWL_HWNDPARENT, Me.hwnd)
End Sub
'---------------------------------------------------------------------------
0
 

Author Comment

by:NIep2001
ID: 6963080
thanks ameba the code worked perfectly
0
 
LVL 15

Expert Comment

by:ameba
ID: 6963093
Thanks!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question