views:

237

answers:

1

I'm working on an app for a mobile device and would like to make a datagrid scrollbar button larger to enhance the touch screen usability. I do not want to alter the system settings windows display properties as this will affect the device as a whole.

Is there an easy way to alter the width of the scrollbar on a datagrid view?

+1  A: 

i think you'll have to roll your own. Not to worry though, it shouldn't be that hard. i say shouldn't because it's been a while since i've done .NET CF UI (shooting from the hip) but have implemented a custom scroller for a .NET 2.0 touch screen UI.

That said, here's what you need to do:

  • Hide the scroll bars in the grid view
  • Create a custom control which hosts two buttons, one top, one bottom
  • Handle the clicks on those buttons and forward them as scroll up/down calls to the grid view

That's the simple way. You don't get the dragging and stuff but that's rarely useful in such a tiny UI anyway. You could also put in later if you want.

Caveat: The grid view might not have ScrollUp/Down APIs exposed. In that case you'll need to overlay your custom control on top of the grid view which will have the scroll bars shown. You hide the built-in scroll bars with your custom control and instead of calling ScrollUp/Down you post windows messages to the area behind your custom control to "fake" clicks and get the grid view to move around the way you like.

Hmm. i was assuming .NET Compact Framework since you mentioned it's for a mobile device... Is it CF? If not, everything ought to be a little easier.

EDIT

Basic sample of custom grid scrolling here!

Paul Sasik
It is actually running full Windows XP, Vista or 7. The display screen is only 5" though.
jasonk