Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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…

911 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

15 Experts available now in Live!

Get 1:1 Help Now