|
-
May 6th, 2008, 11:06 AM
#1
Thread Starter
Hyperactive Member
[2008] Resizing a panel to accomodate scrollbars.
This is silly and I should be able to figure it out.
I have a panel that is occupied by Form objects on demand. I would like the panel's width to match that of the occupying Form. The height of the panel should not change, however.
My problem is here.
When the Form is taller than the panel, scrollbars will appear. This is fine, I want the vertical scrollbar so that the entire Form may be viewed. The problem is; since the vertical scrollbar appears over the Form, the panel adds a horizontal scrollbar so that one may see the portion of the Form that the vertical scrollbar has overlapped.
Is there a way to counter this effect? As in, automatically resizing the width of the panel to accomodate the space the vertical scrollbar takes.
I have been at this for around 40 minutes and feel I am running myself in circles. Thanks for any help supplied.
Prefix has no suffix, but suffix has a prefix.
-
May 6th, 2008, 12:24 PM
#2
Re: [2008] Resizing a panel to accomodate scrollbars.
You can set the panel.width property = yourform.width + 20 or something like that, before adding the form to your panel.
Code:
If yourform.height >= Panel1.Height Then
Panel1.Width = yourform.width + 20
End If
Panel1.controls.add(yourform)
-
May 6th, 2008, 12:39 PM
#3
Thread Starter
Hyperactive Member
Re: [2008] Resizing a panel to accomodate scrollbars.
Is the '+20' supposed to be the width of the scrollbar? Is there a way to find the width of the scrollbar?
Prefix has no suffix, but suffix has a prefix.
-
May 6th, 2008, 12:51 PM
#4
Re: [2008] Resizing a panel to accomodate scrollbars.
Yes, the default width of a scrollbar is 20 pixels. There's no direct way of getting the width of a scrollbar that I know of besides trial and error.
-
May 6th, 2008, 02:31 PM
#5
Thread Starter
Hyperactive Member
Re: [2008] Resizing a panel to accomodate scrollbars.
Ok. How would I determine if the scrollbar is visible. I cannot use Panel1.ScrollStateVScrollVisible because that would be too easy. VB doesn't like it. What should I use?
Prefix has no suffix, but suffix has a prefix.
-
May 6th, 2008, 02:41 PM
#6
Re: [2008] Resizing a panel to accomodate scrollbars.
 Originally Posted by Troy Lundin
Ok. How would I determine if the scrollbar is visible. I cannot use Panel1.ScrollStateVScrollVisible because that would be too easy. VB doesn't like it. What should I use?
The VScroll property of a panel returns a boolean value indicating whether the vertical scrollbar is visible or not.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|