DataGridView & WheelMouse

J

jp2msft

How can I get the DataGridView to scroll with the Mouse Wheel movement?

There aren't any properties to enable it that I have found.
 
C

Cowboy \(Gregory A. Beamer\)

There is nothing in particular to do this, but there are ways to "Fake" it.
Try putting it in a DIV with the overflow turned off in CSS. Then it should
scroll like any other "window within a window" when you use the mouse wheel.
NOTE: the header will scroll as well. To get around that, you will have to
produce a custom Grid view that places the main info in a separate table and
div.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

*************************************************
| Think outside the box!
|
*************************************************
 
C

Chris Shepherd

jp2msft said:
How can I get the DataGridView to scroll with the Mouse Wheel movement?

There aren't any properties to enable it that I have found.

It works for me out of the box.

Which version of the framework?

Are you certain you mean DataGridView (WinForms) and not GridView (Web) as
Gregory suggests?

Chris.
 
J

jake DiMano

The following worked for me.

I added an event handler in the form_load event:

dgv.MouseWheel += new MouseEventHandler(dgv_MouseWheel);

and elsewhere in the form class:

void dgv_MouseWheel(object sender, MouseEventArgs e)
{
//
}

As simple as that. Note that the event handler dgv_MouseWheel does not necessarily need any code to make the mouse wheel work with DataGridView.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top