Click here to Skip to main content
13,146,315 members (47,511 online)
Rate this:
Please Sign up or sign in to vote.

I have a listview on Windows Form, which has groups and 2 columns. First column should show up image and other one is for the text. The listview is set to View = Tile and ImageList is supplied to LargeImageList property.

Now, when i run the application in Windows XP mode the Image doesn't show up where as when the same application when runned on Windows 7, the image shows up in the list.

Application already has code to EnableVisualStyle, please see below.
if (Application.RenderWithVisualStyles == false)
				    var listView1 = new List<listviewitem>();
                    // If visual styles did not turn on (we are in Citrix or they are turned 
                    // off in Windows), we don't want DoEvents to post messages
                    if (Application.RenderWithVisualStyles)

When this code is executed in Windows XP, the inside look doesn't execute DoEvent().
Secondly, even if forcefully executed DoEvents(), still the image doesn't show up in Windows XP.

If anybody could shed some light on this and help me resolve it...

Thank You,

[Edit]Code block added[/Edit]
Posted 4-Dec-12 6:12am
Updated 4-Dec-12 7:11am
What does it mean: "doesn't execute DoEvent()"? (DoEvents, not "DoEvent".)
Why using this method at all?
Member 3830335 5-Dec-12 8:19am
RenderWithVisualStyles stays false after enablingvisualstyles in Windows XP, whereas in Windows 7 it is true. I am not sure if DoEvents() is doing something to help perform controls the same as it is shows up in Windows 7
I did not see this message because you did not reply to mine, you put it on the same level.
Using DoEvents is wrong, in most cases including this...

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

After enabling VisualStyle it may take sometime to get True for RenderWithVisualStyles property. Try executing another DoEvents() before checking this property.
Member 3830335 5-Dec-12 8:19am
What do you specifically mean by "executing another DoEvents()"?
Akbar Ali Hussain 5-Dec-12 12:43pm
Execute Application.DoEvents() after Application.EnableVisualStyles()
Member 3830335 6-Dec-12 9:51am
I implemented what you mentioned but did not resolve the issue. I am running in a VM which is in Windows XP Mode 32 bit. Would that matter?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170915.1 | Last Updated 4 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100