|
-
Jul 2nd, 2007, 11:43 AM
#1
Thread Starter
New Member
Overriding Panel ScrollBar Visibility
How do you set a Panels' aoutoscroll = true and not show the Verticle ScrollBar. The help I read says to "manually override and set VScroll=false". Does this mean create a new class, Inherit Panel, and overide the property VScroll?
If so can you start me off with some code to override?
-
Jul 2nd, 2007, 12:07 PM
#2
Hyperactive Member
Re: Overriding Panel ScrollBar Visibility
vb Code:
Panel1.VerticalScroll.Enabled = False
' or this :
Panel1.VerticalScroll.Visible = False
' try them both
-
Jul 2nd, 2007, 04:51 PM
#3
Thread Starter
New Member
Re: Overriding Panel ScrollBar Visibility
.VerticleScroll is not a member of Panel1 in VB.Net 2003 that I can find
-
Jul 3rd, 2007, 12:32 AM
#4
Re: Overriding Panel ScrollBar Visibility
You will want to override the StyleChanged event of the panel in question. Then check it for the style containing the WS_VSCROLL style.
VB.NET 2003 Code:
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As IntPtr, ByVal nIndex As Integer) As Integer
Public Const GWL_STYLE As Integer = (-16)
Public Const WS_VSCROLL As Integer = &H200000
Public Overridable Sub pnlPanel_StyleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles pnlPanel.StyleChanged
Dim bVScrollBar As Boolean
bVScrollBar = ((GetWindowLong(Me.pnlPanel.Handle, GWL_STYLE) And WS_VSCROLL) = WS_VSCROLL)
If bVScrollBar = True Then
'Remove vertical scrollbar
End If
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 8th, 2007, 10:42 AM
#5
Thread Starter
New Member
Re: Overriding Panel ScrollBar Visibility
Thanks for the previous direction, Testing it however, I can not get the Verticle scroll bars to be removed or hidden
Code:
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As IntPtr, ByVal nIndex As Integer) As Integer
Public Const GWL_STYLE As Integer = (-16)
Public Const WS_VSCROLL As Integer = &H200000
Public Overridable Sub pnlPanel_StyleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Panel2.StyleChanged
Dim bVScrollBar As Boolean
bVScrollBar = ((GetWindowLong(Panel2.Handle, GWL_STYLE) And WS_VSCROLL) = WS_VSCROLL)
If bVScrollBar = True Then
bVScrollBar = False
VScroll = False '????
End If
End Sub
-
Jul 8th, 2007, 01:00 PM
#6
Re: Overriding Panel ScrollBar Visibility
You will need to write code to remove it. 
Use the SetWindowLong API and remove the vertical scrollbar style. Not sure if having items in it that warrent the vertical scrollbar will be an issue but just test it out.
What do you plan don doing to make the controls visible in the panel? Rarrange them or ???
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 9th, 2007, 04:19 PM
#7
Thread Starter
New Member
Re: Overriding Panel ScrollBar Visibility
In response to your last question I have a datagrid on one side of the page and a panel on the other. The datagrid holds representative time durations which are displayed in the panel via rectangular labels which represent a relative time line . Since both the datagrid and panel are the same heigth and their verticle scroll has to be tied together. I am using the dataGrids VScroll position to set the verticle Scroll of the Panel via code. Therefore the panels Verticle scroll is redundant and I would have to tie its movement back to the datagrids VScroll if I left it visible. The latter I do not know how to do --so I thaught it easier to make the panels VScroll Bar non visible.
Would you approached the problem differently?
-
Jul 9th, 2007, 06:39 PM
#8
Re: Overriding Panel ScrollBar Visibility
You can use the Panel1_Scroll event to reverse the mechanics of what you have in place for your datagrid but be careful not to create an infinate loop of scrolling events between the two. Create a boolean variable to identify which control is the source of the scroll.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
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
|