 |
|
 |
EnableVisualStyles() fixed my ListView issue, that was, ListViewItems lost BackColor and ForeColor.
I tried various properties of the ListView and ListViewItem, but none of them worked.
I was almost thinking it must be a display driver bug since the issue occurred only on particular machines.
But, with the EnableVisualStyles(), the ListViewItems' BackColor/ForeColor started working as expected.
Great job!
|
|
|
|
 |
|
 |
I just figured i would add this little tidbit (dont know if anyone else already has.)
The reason the DoEvents is resolving this issue seems to be that EnableVisualStyles sends the rendering to queue to be processed but waits for the windows form to be drawn first before continuing with the visual styles ...
After the form is drawn the rendering occurs therefore if u move this Application.DoEvents(); into the Initialize component just prior to the ImageList ... you end up with the same result but the visualstyles rendering is done just before the imagelist instead of before everything else .. incase there are any concerns of the visual styles being applied too early.
I have not looked deeper into this to see if the visualstyles apply everywhere regardless of when they are rendered however ...
|
|
|
|
 |
|
|
 |
|
 |
Thanks so much!!1!!!That rellyheped.
|
|
|
|
 |
|
 |
Oops. My keyboard isn't working well. I can't edit that, can I?
|
|
|
|
 |
|
 |
Oh, I guess I can. Oh well, I won't.
|
|
|
|
 |
|
 |
Hi,
there is a new issue for the visual styles in .NET 2.0 in a ImageList added to a ListView.
I have a project converted from VS2003 .net 1.1 to VS2005 .net 2.0. Under .NET 1.1 every thing worked fine. Icons which were loaded into the ImageList did appear in the ListView. Application.EnableVisualStyles is set in Main as well as Application.DoEvents which is not required any more for .NET 2.0 (but makes here no difference anyway) .
Now (under VS2005 .NET 2.0) with visual styles enabled, the icons don't appear . When disabling visual styles the icons are shown .
The strange thing is, when I setup an other project from this large solution as the startup project and reference the library which generates the ListView/ImageList in it and create an instance of the form generating code, the icons are shown .
Has anybody had this effect to and can provide a workarround ?
Regards,
xlouk
|
|
|
|
 |
|
|
 |
|
 |
Thanks for the wonderful workaround Man. My head was exploding due to this issue.
Bikash Rai
|
|
|
|
 |
|
 |
first of all thanks to you for your perfect article.
i use buttons that get their pictures from the imagelist.
the flat style is = system
and i use doevent()
all the pictures of the buttons were disapeared.
the toolbar buttons have their own pictures.but the simple buttons dont.
i use vs 2003
thx.
ShArE oR dIe
Born To Win
|
|
|
|
 |
|
 |
I am using Crystal Reports XI with Visual Studio .Net and came across the same symptom with the Crystal Web Viewer not showing icons on their toolbar when I built a web site using the Crystal Server Installation.
I started down this path since it was the only solution I found on line. It turned out not to be this issue at all.
When the new web site was installed, it was one of multiple web sites on the server. It was not the "Default Web Site" for IIS. The Crystal Server installation installed the needed virtual directory in the "Default Web Site" and not my web site that used the Crystal Viewer. A new virtual directory for crystalreportsviewer11 was generated in my web site and this cured the problem.
SmittyInPhilly
SmittyInPhilly
|
|
|
|
 |
|
 |
You're a legend! That seems to be the same problem I'm having. I've tried putting my crystal viewer site within the Default Web Site, and it works fine. BUT, creating another CrystalReportViewers11 virtual directory in my other website doesn't fix it. Is there anything else I should be doing??
|
|
|
|
 |
|
 |
Smitty's solution put me on the right track. But what ended up fixing it for me was this:
In the default website there is a folder: aspnet_client\system_web\2_0_50727 which contains, among other things, the image files for the cyrstal toolbar. Part of this file structure existed on the second website, but not all of it. I copied it across and now it's all working.
|
|
|
|
 |
|
 |
how did you figure that one out? i've been plagued with this issue for the last 4 hours. BO has been no help and i've been to numerous websites with no help either.
|
|
|
|
 |
|
 |
After encountering this bug I followed advice and added the Application.DoEvents() call.
All seemed well, until I noticed that sometimes the very top item in a ListView (in Details view) would not have an image displayed...
Don't know whether this is a generic problem that noone has encountered yet or whether I am doing something specific to cause this...
Cheers
|
|
|
|
 |
|
 |
I was able to set my app to use XP styles but I have an issue with the .NET MonthCalendar control.
When I select 1 day in the calendar, it looks fine with the blue selection color behind the date number (with font in white).
The problem arises when I select more than 1 day, because the control displays the correct range of dates selected but most of the numbers can not be seen because a white bar appears across the range.
I know the problem is the styles (manifest/Application.EnableVisualStyles, it does not matter), 'cause if I do not use XP Syles then the MonthCalendar works fine but, of course, my other controls will not be XP Style-like.
Any ideas about solving this issue?
Thanks,
Carlos
|
|
|
|
 |
|
 |
Sounds like a bug in the calendar control itself. So resolution would have to come from Microsoft.
|
|
|
|
 |
|
 |
For those of you who haven't tried it, check out Skybound Visual Styles[^]. Fixes the styling bugs in the 1.x framework, like NumericUpDown, TabControls, CheckedListBox...
|
|
|
|
 |
|
 |
I was just in the process of reorganizing my code and I ran into this problem with visual styles. Typically I use a manifest but I decided to enable style support directly into the application. As most cases go I moved my Sub Main() out of my frmMain and into a module. This is what I've tyically done (bad practice):
'Application Entry Point
_
Public Sub Main()
Dim fMain As New frmMain
Application.EnableVisualStyles()
Application.DoEvents()
Application.Run(fMain)
End Sub 'Main
Taking this approach always ends up with visual styles be added, but icons and what not are not displayed. A quick solution:
'Application Entry Point
_
Public Sub Main()
'Don't bother with the line below
'Dim fMain As New frmMain
Application.EnableVisualStyles()
Application.DoEvents()
'instead use the "New" keyword
'and the name of your form
Application.Run(New frmMain)
End Sub 'Main
The result is that the visual styles are enabled properly without the fuss.
|
|
|
|
 |
 | Works  |  | Anonymous | 19:44 3 Nov '04 |
|
 |
Works with Application.DoEvents(); change the "FlatStyle" of your controls to "System" and all is well. Thanks.
|
|
|
|
 |
|
 |
According to microsoft the bug causes a messageloop to be run on the wrong thread.
So the DoEvents solutions work by clearing any pending events so two doevents one on each thread are not running simultaneously. The problem with using the DoEventrs method is that you cant be sure that an event will not be created on the original thread at the last moment., say from a mouse move or a timer event. Thus the programmers who had timers going still had problems.
The manifest solution does not suffer from these problems.
Make sure you name the manifest yourprog.exe.manifest where your prog is the executable name. Heres how to set the manifest as a resource..
Add the Manifest to the Executable File
Next, open the executable file within Visual Studio to add the manifest as a resource.
To add the manifest as a resource
In the Visual Studio development environment, on the File menu, point to Open, then click File.
Navigate to the directory containing this Visual Studio solution. This is the directory you saved it in during Step 1 of the "Create the Project" section.
Open the obj directory and then the Debug or Release directory (depending on the build option you set in the development environment).
Locate the executable file (it will be in the form of ProjectName.exe) and double-click it to open it with the Visual Studio environment.
Right-click the executable file in the designer and choose Add Resource.
In the Add Resource dialog box, click the Import button.
Navigate to the manifest file you created, which should be located in the same directory as your solution.
Note Be sure that the Files Of Type field in the dialog box is set to All Files (*.*) so that you can see the manifest file in the file picker.
Double-click the manifest file.
The Custom Resource Type dialog box opens.
In the Resource Type box, type RT_MANIFEST and click OK.
In the Properties window, set the ID property to 1.
From the File menu, choose Save All to save the changes you have made.
|
|
|
|
 |
|
 |
I would not recommend this as it has many problems, one of which causes exceptions to be thrown when showing visualized controls. I don't understand why people don't just use the Manifest files. It will enable themes on XP and doesn't cause any harm on Win98SE to Win2k3. I use it in my product with no problems. Heres the manifest file if anyone needs it: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <description>tester</description> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" /> </dependentAssembly> </dependency> </assembly> - Drew
|
|
|
|
 |
|
 |
For the most part I'd have to agree with you.
It's too bad that EnableVisualStyles is so buggy.
Personally I find manifests a pain in the ass.
I wish VS.NET provided a tool to generate or a manifest to an app. Every time I want to enable themes on a new app, I have to remember where I keep or can get an example to start from.
Having a single, programatic access mechanism, had it worked, would have been nice.
C'est la vie.
|
|
|
|
 |
|
 |
I think ResHacker should be able to stick a .manifest file into an EXE from the command line. Depending on which version of Visual Studio 2003 you have you may be able to specify an after-build command to automatically add the .manifest file in after every build.
|
|
|
|
 |
|
 |
This solution doesn't fix the problem completely. You can still see a problem if you bring up a MessageBox early in your app's loading. I have a timer I set in the main form's Load event. That timers code happens to bring up a MessageBox. That MessageBox is not rendered using visual styles. After you click the OK button of the MessageBox I bring up a form with a tab control in it. The form and the tab control both do not use visual styles. And pretty much any window created there after will not either. Go figure!
The only solution I've found that works all the time is a manifest file.
|
|
|
|
 |