Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / May 2007

Tip: Looking for answers? Try searching our database.

Need To Disable Horizontal Scrolling - Why Is HScroll Property Ignored?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
j0rd4n - 09 May 2007 19:37 GMT
I have a user control that needs to allow vertical scrolling but not
horizontal scrolling.  In the user control's resize event, I need to
adjust the size of all the children controls.  For this to work
correctly, I need the AutoScroll to not enable the horizontal
scrollbar.

After researching MSDN, I found the HScroll which can be used to
disable horizontal scrolling when the AutoScroll mode is enabled.
However, when I disable HScroll, it gets re-enabled again when my user
control is resized.  I tried disabling at the beginning and front of
the resize event handler of the user control, but it still flips back.

Any ideas on how to get this to work?
Brian Schwartz - 10 May 2007 00:02 GMT
Just a shot in the dark--I haven't used HScroll--but what if you disable it
in the Paint event? After a resize, the control is invalidated and painted,
and it may be getting enabled sometime during the paint.

Signature

Brian Schwartz
FishNet Components
http://www.fishnetcomponents.com
Fish Grid .NET Light: Powerful Layouts for Small Datasets

>I have a user control that needs to allow vertical scrolling but not
> horizontal scrolling.  In the user control's resize event, I need to
[quoted text clipped - 9 lines]
>
> Any ideas on how to get this to work?
Brian Schwartz - 10 May 2007 00:15 GMT
Or, as Peter Duniho has pointed out, you might want to override OnPaint to
accomplish this, rather than attaching to the event, depending on your
situation.

Signature

Brian Schwartz
FishNet Components
http://www.fishnetcomponents.com
Fish Grid .NET Light: Powerful Layouts for Small Datasets

> Just a shot in the dark--I haven't used HScroll--but what if you disable
> it in the Paint event? After a resize, the control is invalidated and
[quoted text clipped - 13 lines]
>>
>> Any ideas on how to get this to work?
j0rd4n - 10 May 2007 19:00 GMT
Unfortunately this didn't work quite like I had hoped.  It worked in
some cases but not others.  For instance, if the application starts up
maximized but the control needs scrollbars, and then it is restored to
its non-maximized size, the horizontal scrollbar appears.

Any other ideas?  I tried using the Win32 ShowScrollBar method to
disable the horizontal scrollbar but this just hide it (didn't
actually affect the horizontal sizing of the form).

On May 9, 4:02 pm, "Brian Schwartz" <o...@fishnetcomponentswos.com>
wrote:
> Just a shot in the dark--I haven't used HScroll--but what if you disable it
> in the Paint event? After a resize, the control is invalidated and painted,
[quoted text clipped - 18 lines]
>
> > Any ideas on how to get this to work?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.