cocoadrinker
cocoadrinker

Reputation: 21

How to hide the Scroll bar still Scrolling?

I have some problem that Scroll bar.

I use the Scroll Function in Panel to Look information

but Scroll bar make to shorten information cause width size is fix

so i want to remove or hide the scroll bar

do you have any solving this problem?

Upvotes: 0

Views: 2533

Answers (2)

OctaCode
OctaCode

Reputation: 645

ok so here it is, vb.net, tested, panel2 inside panel1, panel2's width a bit bigger than panel1:

Public Class Form1

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    Panel1.HorizontalScroll.Visible = False
    Panel1.VerticalScroll.Visible = False

    Panel2.AutoScroll = True
    Panel2.HorizontalScroll.Visible = False
    Panel2.VerticalScroll.Visible = True

End Sub

Private Sub Panel2_MouseWheel(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Panel2.MouseWheel
    If Panel2.Bounds.Contains(e.Location) Then
        Dim vScrollPosition As Integer = Panel2.VerticalScroll.Value
        vScrollPosition = e.Location.Y
        Panel2.Invalidate()
    End If
End Sub

Private Sub Panel2_MouseEnter(sender As Object, e As EventArgs) Handles Panel2.MouseEnter
    Panel2.Select()
End Sub

End Class

Upvotes: 1

user11773533
user11773533

Reputation:

you simply use this where you need in the code to deactivate the scrolls.Try it

panel1.AutoScroll = false;

Upvotes: 0

Related Questions