473,503 Members | 12,791 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Disabling Hscroll in ScrollableControl

Bob
I implemented a ScrollableControl and only want vertical scrolling. Every time I make the form smaller then the control
the control has h scroll bars even though I set it to false. I have the control anchored to all four corners. I watched the resize event and for some reason even if i keep setting hscroll to false it gets set back to true.

Thanks!

FromMSDN.

To manually override which scroll bars are visible, set the VScroll and HScroll properties. If either property is set to false, the corresponding scroll bar will not be visible, even if the AutoScroll property is set to true.


Public Class TestControl
Inherits System.Windows.Forms.ScrollableControl
Implements IContainerControl

Private myActiveControl As Control

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()
' Make the container scrollable.

'Add any initialization after the InitializeComponent() call
Me.AutoScroll = True
Me.VScroll = True
Me.HScroll = False

End Sub

'UserControl overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub

#End Region

' Add implementation to the IContainerControl.ActiveControl property.
Public Property ActiveControl() As Control Implements IContainerControl.ActiveControl
Get
Return Me.myActiveControl
End Get

Set(ByVal Value As Control)
' Make sure the control is a member of the ControlCollection.
If Me.Controls.Contains(value) Then
Me.myActiveControl = value
End If
End Set
End Property

' Add implementation to the IContainerControl.ActivateControl(Control) method.
Public Function ActivateControl(ByVal active As Control) As Boolean Implements IContainerControl.ActivateControl
If Me.Controls.Contains(active) Then
' Select the control and scroll the control into view if needed.
active.Select()
Me.ScrollControlIntoView(active)
Me.myActiveControl = active
Return True
End If
Return False
End Function

Public Property MyHScroll() As Boolean
Get
Return Me.HScroll
End Get
Set(ByVal Value As Boolean)
Me.HScroll = Value
End Set
End Property


End Class

Nov 20 '05 #1
0 1375

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1353
by: news.microsoft.com | last post by:
Hi, When I process a HScroll scroll event I get one event fired for a increase value using the > button. When I make a User control with a HScroll on it and catch the message and forward my...
1
4327
by: Gates72 | last post by:
Hi Gurus, I am attempting to derive a User Control from the ScrollableControl class. I need to have control over which scrollbars get displayed. According to MSDN: "To manually override...
4
4140
by: Steve | last post by:
I have the MDI MFC application ported to .NET. Now this application include mixed managed/unmanaged code. The application displays progress dialog with the cancel button during lenghtly...
3
1602
by: PB | last post by:
What is the rationalle for disabling JavaScript. AFAIK, the primary reason is for "security purposes" - but what specific kind of threats does the protect against? AND - is the disabling of...
12
2233
by: Nalaka | last post by:
Hi, I suddenly started getting a lot of errors from html validation (some CSS) so I followed the following instructions to disable it. If you'd rather not have these types of HTML validation...
6
4385
by: Yehia A.Salam | last post by:
Hello, I'm trying to create my own control derived from ScrollableControl public partial class qViewer : ScrollableControl{ public qViewer() { VScroll = true; AutoScroll = true; } ... }
2
5553
by: Rune Jacobsen | last post by:
Hi all, I have a few questions on deriving from ScrollableControl that I hope will be relatively easy to answer. I am using Visual Studio 2003, C# and ..Net 1.1. I have this custom control I...
9
2449
by: 7stud | last post by:
Hi, I'm trying to allow for a horizontal scrollbar on a textarea, but the scrollbar won't appear when I enter a long string of text(by leaning on one character on my keyboard): import wx ...
5
4905
by: jehugaleahsa | last post by:
Hello: I am sure this question comes up a lot. I need to disable the controls on my Windows forms so that when the BindingSource is empty some the controls bound to it will be disabled. This...
0
7296
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7364
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4696
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3186
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1524
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
405
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.