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 / Windows Forms / WinForm General / April 2005

Tip: Looking for answers? Try searching our database.

simplest way to use scrollbars without Autoscroll?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kaimar Seljamäe - 19 Apr 2005 21:56 GMT
Hi,

I would like to use Form's AutoScroll property, but only partially.
Everything is ok except scrolling when ActiveControl changes (the first
part of "AutoScroll").
For example my code calls someControl.Focus() which results in scrolling
even if the someControl is partially visible. Tab key and mouse click
behave in the same way :(
Is it possible to disable that part of autoscrolling features and still
use built-in scrollbars? Maybe some WndProc() trick?

I got it to work with AutoScroll=False but I don't like the idea of
implementing  all the scrolling from scratch (scrollbar events, page
up/down etc keys, mouse wheel)

Thanks in advance!
Kaimar Seljamäe
Adrian - 20 Apr 2005 11:34 GMT
Hi!
You could use the code below for your control.

protected override void WndProc(ref System.Windows.Forms.Message m)
{
   base.WndProc (ref m);
   if ((m.Msg == 0x0115))
   {
       //scroll down
       if (m.WParam.ToInt32() == 1)
       {
       ...
       }
       else
       {
           //scroll up
           if (m.WParam.ToInt32() == 0)
           {
           ...
           }
       }
   }
}

Hope that helps.
Best regards, Adrian.

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.