Solved

how to resize the windows as in Windows Explorer/Books Online

Posted on 1998-07-09
3
235 Views
Last Modified: 2010-08-05
I am using a treeview control and webbrowser control in the same form. I want to resize these controls dynamically.(like in VB Books online or Windows Explorer)In the above two, there will be a floating control and by moving this control the two controls resizes. Can any one help me in this regard?
0
Comment
Question by:mskannan
3 Comments
 
LVL 1

Accepted Solution

by:
gissing earned 150 total points
ID: 1465289
Presumably this is under VB 5.0? If so, start a new project and select "VB Application Wizard" from the list of projects. Select the "Explorer Style" radio button for the application type and any other options you require. When you click "Finish" it will build a template explorer application.

From memory, I believe it uses a transparent picture box in the vertical gab between the tree view on the left and the listview (webbrowser in your case) on the right. It responds to mouse events, and when you drag and drop it, the tree view and list view resize themselves appropriately.

You can take this template code and stuff it into your own application and voila! one explorer!

Hope this helps...
0
 
LVL 6

Expert Comment

by:anthonyc
ID: 1465290
This is very easy to do....

Put a frame (its a lot lighter weight control than a picturebox) on your form, give it a width of 15 or 45 (personal preference).

In the form resize event:

private sub form_resize()
   'this will handle resizing of the frame AND the form itself
   frame1.height = me.scaleheight
   treeview1.move 0, 0, frame1.left, me.scaleheight
   webbrowser1.move frame1.left + frame1.width, 0
   webbrowser1.height = me.scaleheight
   webbrowser1.width = me.scalewidth - webbrowswer1.left
end sub

Now, in the frame's events

Declare Function SetCapture Lib "user32" Alias "SetCapture" (ByVal hwnd As Long) As Long
Declare Function ReleaseCapture Lib "user32" Alias "ReleaseCapture" () As Long

Private Sub frame1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
     if button and vbleftbutton then
        setcapture frame1.hwnd
        screen.mousepointer = vbSize 'or whatever constant you want
    end if
End Sub

Private Sub frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    static bWorking as boolean

    if not bworking then
        bworking = true
        if button and vbleftbutton then
           frame1.left = frame1.left + x
           form_resize
        end if
        bworking = false
    end if
end sub

Private Sub Frame1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ReleaseCapture
    screen.mousepointer = vbdefault
End Sub


SetCapture and Release Capture are VERY important.   They allow the mouse to move outside the actual realm of the frame, and still have the frame's event's react.  This allows the control to resize as fast as you like.  Without it, you would have to move the mouse slow

Hope this helps more...   Now if I can only get some points.
0
 

Author Comment

by:mskannan
ID: 1465291

Hai Guys,
Thank you for your answers.
It is working fine.

Regards,
mskannan
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…

706 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now