ListView control functionality issues

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
 
S

Scot Rose [MSFT]

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.




--------------------
 

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