?
Solved

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

Posted on 1998-07-09
3
Medium Priority
?
249 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 600 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

862 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