?
Solved

Scroll Bars Component for Visual Basic

Posted on 2002-07-07
4
Medium Priority
?
209 Views
Last Modified: 2013-11-25
Where Cand I download an VB Component to control my Form scroll bars??
I don't want to programme all the lines to adapt my form to the scroll bars that come in visual basic. I want a componet that does this automatically...
does it exists???

THANKS
0
Comment
Question by:mltolun
[X]
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
  • 2
4 Comments
 
LVL 22

Accepted Solution

by:
rspahitz earned 400 total points
ID: 7138363
If I understand you correctly, you want a form that has a scrollable display area.  I have not seen such a form, but creating a control for it is relatively simple.

To do this, simply add a picturebox (named picScrollPanel, borderless) into the form, add horizontal and vertical scroll bars (named scrHorizontal and scrVertical, tabstop property=false) on the bottom and right, then add a textbox (named txtHideCorner, frameless, background=buttonface, text blank) to the lower right corner to hide that spot.

In your form's resize procedure:

Private Sub Form_Resize()
  scrHorizontal.Move 0, Me.ScaleHeight - scrHorizontal.Height, Me.ScaleWidth - scrVertical.Width
  scrVertical.Move Me.ScaleWidth - scrVertical.Width, 0, scrVertical.Width, Me.ScaleHeight - scrHorizontal.Height
  txtHideSpot.Move scrVertical.Left, scrHorizontal.Top, scrVertical.Width, scrHorizontal.Height
  picScrollWindow.Move 0, 0, 'scrVertical.Left, scrHorizontal.Top' no need to resize the picturebox or the scrolling effect won't work!
 
  ' Set scroll bar max
  lScrollMax = Me.ScaleWidth - picScrollWindow.Width
  If lScrollMax <= 0 Then
    scrHorizontal.Max = -lScrollMax
  Else
    scrHorizontal.Max = scrHorizontal.Min
  End If
 
  lScrollMax = Me.ScaleHeight - picScrollWindow.Height
  If lScrollMax <= 0 Then
    scrVertical.Max = -lScrollMax
  Else
    scrVertical.Max = scrVertical.Min
  End If
End Sub

At design time, place all controls into the picturebox, as large as you'd like.

Then add the following code to make the scrolling work:

Private Sub scrHorizontal_Change()
  picScrollWindow.Left = -scrHorizontal.Value
End Sub

Private Sub scrHorizontal_Scroll()
  scrHorizontal_Change
End Sub

Private Sub scrVertical_Change()
  picScrollWindow.Top = -scrVertical.Value
End Sub

Private Sub scrVertical_Scroll()
  scrVertical_Change
End Sub
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 7138376
If I understand you correctly, you want a form that has a scrollable display area.  I have not seen such a form, but creating a control for it is relatively simple.

To do this, simply add a picturebox (named picScrollPanel, borderless) into the form, add horizontal and vertical scroll bars (named scrHorizontal and scrVertical, tabstop property=false) on the bottom and right, then add a textbox (named txtHideCorner, frameless, background=buttonface, text blank) to the lower right corner to hide that spot.

In your form's resize procedure:

Private Sub Form_Resize()
  scrHorizontal.Move 0, Me.ScaleHeight - scrHorizontal.Height, Me.ScaleWidth - scrVertical.Width
  scrVertical.Move Me.ScaleWidth - scrVertical.Width, 0, scrVertical.Width, Me.ScaleHeight - scrHorizontal.Height
  txtHideSpot.Move scrVertical.Left, scrHorizontal.Top, scrVertical.Width, scrHorizontal.Height
  picScrollWindow.Move 0, 0, 'scrVertical.Left, scrHorizontal.Top' no need to resize the picturebox or the scrolling effect won't work!
 
  ' Set scroll bar max
  lScrollMax = Me.ScaleWidth - picScrollWindow.Width
  If lScrollMax <= 0 Then
    scrHorizontal.Max = -lScrollMax
  Else
    scrHorizontal.Max = scrHorizontal.Min
  End If
 
  lScrollMax = Me.ScaleHeight - picScrollWindow.Height
  If lScrollMax <= 0 Then
    scrVertical.Max = -lScrollMax
  Else
    scrVertical.Max = scrVertical.Min
  End If
End Sub

At design time, place all controls into the picturebox, as large as you'd like.

Then add the following code to make the scrolling work:

Private Sub scrHorizontal_Change()
  picScrollWindow.Left = -scrHorizontal.Value
End Sub

Private Sub scrHorizontal_Scroll()
  scrHorizontal_Change
End Sub

Private Sub scrVertical_Change()
  picScrollWindow.Top = -scrVertical.Value
End Sub

Private Sub scrVertical_Scroll()
  scrVertical_Change
End Sub
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7990833
Hi mltolun,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept rspahitz's comment(s) as an answer.

mltolun, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.
==========
DanRollins -- EE database cleanup volunteer
0
 

Expert Comment

by:SpideyMod
ID: 8053140
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
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…

765 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