Solved

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

Posted on 1998-07-09
3
241 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

770 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