Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…

856 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