Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Pro Visual Basic 2005
|
Pro Visual Basic 2005 For advanced Visual Basic coders working in version 2005. Beginning-level questions will be redirected to other forums, including Beginning VB 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro Visual Basic 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 10th, 2008, 04:33 PM
Registered User
 
Join Date: Nov 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Stop MouseWheel from autogenerating scroll msgs?

I have a VirtualMode DataGridView that bogs down on using the mouse wheel to scroll and gets a backlog of messages such that it continues to scroll long after ceasing to turn the mouse wheel. This is because instead of generating one scrollbar message for each mouse wheel message it generates a separate scrollbar message for each line move, forcing the entire screen to refresh with each line added.

I've put in code to scroll multiple lines only once for each mouse wheel click, but I'm still having to shunt out all of the extra scrollbar messages and it is not easy. If I get out of sync as to how many scrollbar messages to shunt the scrolling goes out of whack. It would be far easier if I just didn't have to worry about shunting these useless messages.

So how do you prevent mouse wheel messages from creating scrollbar messages?
 
Old June 11th, 2008, 10:04 AM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Just shooting from the hip here, but have you tried the .Handled statement in the mousewheel event procedure to eliminate further bubbling up (through the scrollbar event handler, for instance) of the messages?
 
Old June 11th, 2008, 01:35 PM
Registered User
 
Join Date: Nov 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There is no Handled member of the MouseEventArgs class. You had me really excited there for a moment!

 
Old June 11th, 2008, 03:43 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Do you think it might be possible to add something useful to the MouseWheel()'s "Handles" list the additional events so that all comers come to the same routine? (I don't really have a candidate in mind.)

Perhaps you could then use a global boolean to block re-entrance into that procedure until the time of your choosing. Perhaps that will allow you to put the brakes on just a little, and that will be enough.

I didn't realize that .handled was kind of limited to key events... Sorry.
 
Old June 12th, 2008, 01:50 PM
Registered User
 
Join Date: Nov 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Looks like I have a couple of options, derive my own DataGridView and override the WndProc function, or check the sender in the grid's scroll handler and shunt the extra scroll messages manually.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Stop button won't stop loop JDShaffer Visual Basic 2008 Essentials 3 May 23rd, 2008 03:22 PM
mousewheel on crystalreportviewer SabinoFonseca VB.NET 2002/2003 Basics 1 October 10th, 2007 12:34 PM
How to Disable a Mousewheel Brendan Bartley Access 2 August 28th, 2005 07:36 PM
mousewheel causes subform to advance a record Loralee Access VBA 1 October 27th, 2004 11:14 PM
MQMgmtGetInfo trashes OS; Msgs queue up WBaran Pro VB 6 0 December 29th, 2003 06:03 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.