Ok. I haven't been around for a while, so I hope someone will come to my
rescue. I thought I had done this years ago, but I have scoured my code
snippets and can't find it.
I want my ListView control to have a different background colour on
alternate rows. I'm using VS2005.
Firstly, I'm surprised that I can't do it out of the box. But secondly, I
can't find a really simple one-liner that let's me do it by overriding
something.
I could owner draw, or custom draw, but these seem to be the hammer to crack
the nut. Is there a way to do this easily?
Failing that, what is the preferred way?
TIA
Charles 3 2188
On Oct 14, 11:59 pm, "Charles Law" <bl...@nowhere. comwrote:
Ok. I haven't been around for a while, so I hope someone will come to my
rescue. I thought I had done this years ago, but I have scoured my code
snippets and can't find it.
I want my ListView control to have a different background colour on
alternate rows. I'm using VS2005.
Firstly, I'm surprised that I can't do it out of the box. But secondly, I
can't find a really simple one-liner that let's me do it by overriding
something.
I could owner draw, or custom draw, but these seem to be the hammer to crack
the nut. Is there a way to do this easily?
Failing that, what is the preferred way?
TIA
Charles
You can do it out of the box.
dim yellow as boolean = true
For each lvi as ListViewItem in lvItems
if (yellow) then
lvi.backcolor = color.yellow
else
lvi.backcolor = color.white
end if
yellow = not yellow
Next
Hi Phillip
Thanks for the response.
What happens when I add an item? Does it get the correct background
according to whether the new row is odd or even?
In addition, I would like the grid to have alternate colours for the rows,
irrespective of whether there are any items in the list.
Charles
"Phillip Taylor" <Ph************ *****@gmail.com wrote in message
news:11******** **************@ i13g2000prf.goo glegroups.com.. .
On Oct 14, 11:59 pm, "Charles Law" <bl...@nowhere. comwrote:
>Ok. I haven't been around for a while, so I hope someone will come to my rescue. I thought I had done this years ago, but I have scoured my code snippets and can't find it.
I want my ListView control to have a different background colour on alternate rows. I'm using VS2005.
Firstly, I'm surprised that I can't do it out of the box. But secondly, I can't find a really simple one-liner that let's me do it by overriding something.
I could owner draw, or custom draw, but these seem to be the hammer to crack the nut. Is there a way to do this easily?
Failing that, what is the preferred way?
TIA
Charles
You can do it out of the box.
dim yellow as boolean = true
For each lvi as ListViewItem in lvItems
if (yellow) then
lvi.backcolor = color.yellow
else
lvi.backcolor = color.white
end if
yellow = not yellow
Next
I should add that I want the background of alternate rows coloured
differently, even when there are no items in the list view. So, setting the
background colour of each item doesn't work.
Does anyone have an idea?
Charles
"Charles Law" <bl***@nowhere. comwrote in message
news:uQ******** ******@TK2MSFTN GP05.phx.gbl...
Ok. I haven't been around for a while, so I hope someone will come to my
rescue. I thought I had done this years ago, but I have scoured my code
snippets and can't find it.
I want my ListView control to have a different background colour on
alternate rows. I'm using VS2005.
Firstly, I'm surprised that I can't do it out of the box. But secondly, I
can't find a really simple one-liner that let's me do it by overriding
something.
I could owner draw, or custom draw, but these seem to be the hammer to
crack the nut. Is there a way to do this easily?
Failing that, what is the preferred way?
TIA
Charles
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: aznFETISH |
last post by:
I have a list of links that I ue on my page, I alternate background colors
for these links in a table, I usually do it using a DB but this list of link
is manually added into the page so my question, is it possible to alternate
the row colors automatic and have it created from a list of URL's?
|
by: Els |
last post by:
Hi,
I would like an opinion on the following:
I have a page which is made up of background-images with transparent
linked images in front of it, which on hover show text in CSS popups.
Due to appropriate alt text, anyone viewing the page with images
turned off, will see the alt text instead, and on hover will see the
popups.
|
by: Peter Williams |
last post by:
Hi All,
I want to write some javascript for a html page which does the
following.
Imagine that the page contains a table with 2 columns and 3 rows, e.g.:
+---+---+
| A | B |
+---+---+
|
by: Doug Laidlaw |
last post by:
I tried to grab an image from a Web page the other day. It turned out that
the page was made up of three horizontal bands, and part of the image was
in each. One band was a JPEG, another was a GIF and I have forgotten what
the main page was.
Apart from lining up the parts of the image, there was no discrepancy in
colours between the two...
|
by: Matt B |
last post by:
I have a need to alternate output row colour where not every row in the
sequence is output, so I cannot base the colour on whether position() is odd
or even.
e.g.
....
<xsl:for-each select="result">
<xsl:if test="@status = 'Pass'">
<tr><td>@name</td></tr>
</xsl:if>
<xsl:for-each>
| |
by: sconeek |
last post by:
Hi all,
I am generating a html based table with multiple rows of data coming
in real time from a postgres DB. The underlying technology is java
based however the front end is html.
now i am unable to alternate the colour of every row so that the table
is lot more readable. can anyone suggest a javascript or even a css
script which will...
|
by: Eric Lindsay |
last post by:
I am trying to understand the differences between and uses of
persistent, default and alternate styles. I have read
http://www.w3.org/TR/REC-html40/present/styles.html section 14.3.2 on
specifying external style sheets in link using combinations of rel and
using or not using the title attribute.
I think I sort of understand rel="alternate...
|
by: sconeek |
last post by:
hi all,
my java servlet code has a foreach loop which automatically generates a
HTML table with x number of rows.
now my problem is that I would like the rows to be alternating in
colour so that its a lot more easier to read. i have tried to implement
a few approaches but everytime it fails.
can somebody help me out with us and suggest a...
|
by: Mr. B |
last post by:
I've not programmed for a while in VB 2003... but I've decided to modlfiy a
Project I have.
Seems simple enough... I've a List Box... I fill it with about 30 lines of
data (3-4 columns).
What I want to do is to be able to List the ROWS of data either a RED or GREEN
colour depending upon an IF statement.
So... IF X =< myVariable then...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |