Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Windows Application Forms , +
Hi,
 
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>();
                    Application.EnableVisualStyles();
 
                    // 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)
                        Application.DoEvents();
                }
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,
Rachna
 
[Edit]Code block added[/Edit]
Posted 4-Dec-12 7:12am
Edited 4-Dec-12 8:11am
ProgramFOX127.9K
v2
Comments
Sergey Alexandrovich Kryukov at 4-Dec-12 16:14pm
   
What does it mean: "doesn't execute DoEvent()"? (DoEvents, not "DoEvent".)
Why using this method at all?
--SA
Member 3830335 at 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
Sergey Alexandrovich Kryukov at 8-Jan-13 13:20pm
   
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...
—SA

1 solution

Rate this: bad
good
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.
  Permalink  
Comments
Member 3830335 at 5-Dec-12 8:19am
   
What do you specifically mean by "executing another DoEvents()"?
Akbar Ali Hussain at 5-Dec-12 12:43pm
   
Execute Application.DoEvents() after Application.EnableVisualStyles()
Member 3830335 at 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
0 OriginalGriff 475
1 Maciej Los 349
2 Richard MacCutchan 220
3 BillWoodruff 219
4 Mathew Soji 160
0 OriginalGriff 8,759
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,269
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web04 | 2.8.1411028.1 | Last Updated 4 Dec 2012
Copyright © CodeProject, 1999-2014
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