CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 1999
    Posts
    84

    Progress Bar in MDI

    Hello,

    Can we place place the Progress Bar in a Status Bar on a MDI application's main form? If so, please give me the way to do it.


    Thanks
    Harini

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

    Re: Progress Bar in MDI

    You place the status bar and the progress bar as they will stay aligned to the bottom and top respectively. This code will place the progress bar on the status bar.


    private Declare Function SetParent Lib "user32" (byval hWndChild as Long, byval hWndNewParent as Long) as Long
    private Sub MDIForm_Load()
    SetParent ProgressBar1.hWnd, StatusBar1.hWnd
    ProgressBar1.Value = 50
    ProgressBar1.Top = 0
    End Sub





  3. #3
    Join Date
    Jul 1999
    Posts
    84

    Re: Progress Bar in MDI

    How can I place this progress bar into one of the panels of the Status bar?

    Thanks
    Harini

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

    Re: Progress Bar in MDI

    The usual procedure is to set the align property of the control you want to place on the status bar (in this case the progress bar) to vbAlignNone, and then set the left and top properties accordingly. But the progress bar did not leave its vbAlignTop value, so I had to work out an workaround.

    Place your progress bar in a picture box on the MDI form. Now, use Setparent to position this picturebox on the status bar.


    private Declare Function SetParent Lib "user32" (byval hWndChild as Long, byval hWndNewParent as Long) as Long


    private Sub MDIForm_activate()
    SetParent Picture1.hWnd, StatusBar1.hWnd
    ProgressBar1.Value = 50
    Picture1.Align = 0
    Picture1.Top = 0
    Picture1.Left = StatusBar1.Panels(2).Left
    Picture1.Width = StatusBar1.Panels(2).Width
    End Sub

    private Sub Picture1_Resize()
    ProgressBar1.Width = Picture1.ScaleWidth
    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

Featured