How can I detect if the scrollbars are visible or not on a panel
that has the AutoScroll property set to True?
This doesn't work.
Thanks in advanceVB Code:
If pnlPanel.ScrollStateVScrollVisible = True Then
Printable View
How can I detect if the scrollbars are visible or not on a panel
that has the AutoScroll property set to True?
This doesn't work.
Thanks in advanceVB Code:
If pnlPanel.ScrollStateVScrollVisible = True Then
ScrollStateVScrollVisible is a constant, not a property or anything. That's why that doesn't work.
If you inherit from Panel, you can check the VScroll and HScroll properties. They are Protected, so you can only access them through inheritance. Otherwise this should work...
VB Code:
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As IntPtr, _ ByVal nIndex As Integer) _ As Integer Private Const GWL_STYLE As Integer = (-16) Private Const WS_VSCROLL As Integer = &H200000 Private Sub Panel1_StyleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Panel1.StyleChanged Me.Text = ((GetWindowLong(Panel1.Handle, GWL_STYLE) And WS_VSCROLL) = WS_VSCROLL) End Sub
This appears to work as well:
VB Code:
If Panel1.DisplayRectangle.Height = Panel1.Size.Height Then MsgBox("No Scroll") Else MsgBox("Scroll") End If
Thanks guys. I will try out both versions tonight when I get home.
Ok, I got both of them to work. I guess its just personal preference
of which programming logic to use.
Thanks guys for the help.:thumb: