listview scrollbars removing or user control

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

I have basically a 2 part question:

1) is there a way to have a listview that can scroll, but hide the
scrollbars. I know that sounds odd, but this is a touch screen app
and there are "scroll buttons (just command buttons with graphic)"
that go to the next/previous item in the list and that allows the
scrolling. I know they can drag the scroll bar down by touching, but
that causes me a problem when the selected item goes out of view (see
item 2 below). The only way I found was to turn scrollable=false, but
that caused the list to not be able to go past the display no matter
what was in the list, even when using the ensurevisible method.

2) The other option I have is catching the scroll message by
overriding the WndProc and calling ensurevisible on the selected item.
However to do that, I think (and correct me if I'm wrong) I need to
create a new Listview that inherits from the .net listview and put the
override in that class. I've never done that before, so do I have to
create a User Control, Inherited control, or what ? Does it have to
be in its own .dll so it can be referenced or can it reside in the
main project itself ? Basically, I dont have a real good feel for
this aspect yet.

Or maybe there are other ways to accomplish what I need ?

Many TIA,
Mark
 
Sorry, you should also include this in code for classes that inherit from
controls (otherwise InitializeComponent will never be called):

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub
 
Thanks for the example. It's very helpful.

As far as the project that uses this, I would build an Inherited
Control project, compile this to a .dll, then use it on my form ? Is
that the correct way to do it ?
 
Back
Top