JeffreyB723
New member
- Joined
- Oct 4, 2010
- Messages
- 2
- Programming Experience
- 5-10
I have a TopBar, A LeftBar, A VScrollBar, A HScrollBar and a Panel inside a SplitContainer Panel.
The issue I'm having is that when my SplitContainer Panel is small enough to enable one of the ScrollBars, I will slide the ScrollBar and then when I resize the Split Panel, my Panel1 is staying where I scrolled it too. I'm having troubles thinking of the correct code to fix this.
Here is my Code:
Private Sub HScrollBar1_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HScrollBar1.Resize
If TopBar.Right > VScrollBar1.Left Then
HScrollBar1.Enabled = True
If VScrollBar1.Left - LeftBar.Right > 0 Then
HScrollBar1.LargeChange = VScrollBar1.Left - LeftBar.Right
HScrollBar1.Maximum = Panel1.Width
End If
Else : HScrollBar1.Enabled = False
End If
End Sub
Private Sub VScrollBar1_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VScrollBar1.Resize
If LeftBar.Bottom > HScrollBar1.Top Then
VScrollBar1.Enabled = True
If HScrollBar1.Top - TopBar.Bottom > 0 Then
VScrollBar1.LargeChange = HScrollBar1.Top - TopBar.Bottom
VScrollBar1.Maximum = Panel1.Height
End If
Else : HScrollBar1.Enabled = False
End If
End Sub
Private Sub HScrollBar1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HScrollBar1.ValueChanged
Panel1.Left = LeftBar.Right - HScrollBar1.Value
TopBar.Left = LeftBar.Right - HScrollBar1.Value
End Sub
Private Sub VScrollBar1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VScrollBar1.ValueChanged
Panel1.Top = TopBar.Bottom - VScrollBar1.Value
LeftBar.Top = TopBar.Bottom - VScrollBar1.Value
End Sub
Thanks for any help.
The issue I'm having is that when my SplitContainer Panel is small enough to enable one of the ScrollBars, I will slide the ScrollBar and then when I resize the Split Panel, my Panel1 is staying where I scrolled it too. I'm having troubles thinking of the correct code to fix this.
Here is my Code:
Private Sub HScrollBar1_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HScrollBar1.Resize
If TopBar.Right > VScrollBar1.Left Then
HScrollBar1.Enabled = True
If VScrollBar1.Left - LeftBar.Right > 0 Then
HScrollBar1.LargeChange = VScrollBar1.Left - LeftBar.Right
HScrollBar1.Maximum = Panel1.Width
End If
Else : HScrollBar1.Enabled = False
End If
End Sub
Private Sub VScrollBar1_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VScrollBar1.Resize
If LeftBar.Bottom > HScrollBar1.Top Then
VScrollBar1.Enabled = True
If HScrollBar1.Top - TopBar.Bottom > 0 Then
VScrollBar1.LargeChange = HScrollBar1.Top - TopBar.Bottom
VScrollBar1.Maximum = Panel1.Height
End If
Else : HScrollBar1.Enabled = False
End If
End Sub
Private Sub HScrollBar1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HScrollBar1.ValueChanged
Panel1.Left = LeftBar.Right - HScrollBar1.Value
TopBar.Left = LeftBar.Right - HScrollBar1.Value
End Sub
Private Sub VScrollBar1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VScrollBar1.ValueChanged
Panel1.Top = TopBar.Bottom - VScrollBar1.Value
LeftBar.Top = TopBar.Bottom - VScrollBar1.Value
End Sub
Thanks for any help.