ListView control functionality issues

  • Thread starter Thread starter John Cottrell
  • Start date Start date
J

John Cottrell

Hello,

I have a few functionality issues with the ListView
control that I'm hoping someone might be able to shed some
light on.

1) I need to be able to hide the vertical scroll bar but
still allow scrolling programmatically. The Scrollable
property hides the vertical scroll bar but also prevents
the items in the list from being scrolled programmatically.

2) I want to display the horizontal scroll bar at all
times. I can kludge a work-around for this by forcing the
combined column widths to always exceed the width of the
control, however, this isn't aesthetically pleasing and
I'm hoping there's a more elegant way to accomplish this.

3) Set the foreground and background colors for a selected
item in a control that doesn't have focus. If I
set .HideSelection = False then when the control losses
focus it continues to display the highlighted item(s),
however, the background color is gray. I need to be able
to set the foreground/background colors to a different
setting.

If anyone can provide any assistance on these items, it
will be greatly appreciated.

Thanks,

John
 
Unfortuntely, for the first question, there isn't a way to get rid of the Scrollbar except turning Scrollable to false..

For the second question, just add a scrollbar to the listviews control collection and set it accordingly

Dim MyScrollbar As New System.Windows.Forms.HScrollBar()
MyScrollbar.Left = 0
MyScrollbar.Top = ListView1.Height - 19
MyScrollbar.Height = 15
MyScrollbar.Width = ListView1.Width - 4
MyScrollbar.Visible = True
MyScrollbar.Enabled = False
ListView1.Controls.Add(MyScrollbar)

for the third. Does this not work?

ListView1.Items(5).BackColor = System.Drawing.Color.Blue
ListView1.Items(5).ForeColor = System.Drawing.Color.White

Want to know more? Check out the MSDN Library at http://msdn.microsoft.com or the Microsoft Knowledge Base at http://support.microsoft.com

Scot Rose, MCSD
Microsoft Visual Basic Developer Support
Email : (e-mail address removed) <Remove word online. from address>

This posting is provided “AS IS”, with no warranties, and confers no rights.




--------------------
 
Back
Top