472,371 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,371 software developers and data experts.

Disabling Hscroll in ScrollableControl

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.



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()

'This call is required by the Windows Form Designer.
' 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
End If
End If
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
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.
Me.myActiveControl = active
Return True
End If
Return False
End Function

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

End Class

Nov 20 '05 #1
0 1313

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

Similar topics

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...
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...
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...
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...
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...
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; } ... }
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...
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 ...
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...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

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.