C
chaf2701
Hi,
I was in trouble with the System.Windows.Forms.ImageList control from
VC.NET. I was doing the following :
1. New Project, C#, Windows Application
2. Add ImageList component imageList1 to Form1
3. in imageList1 properties open the 'Image Collection Editor' for
Images
and add a simple copy.bmp
4. build and run the application
What I get here is an TargetInvocationException at this line
this.imageList1.ImageStream =
((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.Im
ageStream")));
I finally found a solution for that and I just want to post it for
others who may encounter this problem.
VC.NET is using an application manifest to enable visual styles within
the IDE with "devenv.exe". I don't know why but the problem cames from
that manifest file. To fix the problem, create a manifest file and name
it yourappname.exe.manifest
Paste this code into that file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="WindowsXP"
type="win32"
/>
<description>Your application description here.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
Now, use this file for any application you want to use XP styles for,
including VS.NET. You can put this manifest file in the .NET app
folder. Run VS.NET and you'll see xp styles. Make sure "flatstyle" for
your buttons and frames is set to "system".
I was in trouble with the System.Windows.Forms.ImageList control from
VC.NET. I was doing the following :
1. New Project, C#, Windows Application
2. Add ImageList component imageList1 to Form1
3. in imageList1 properties open the 'Image Collection Editor' for
Images
and add a simple copy.bmp
4. build and run the application
What I get here is an TargetInvocationException at this line
this.imageList1.ImageStream =
((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.Im
ageStream")));
I finally found a solution for that and I just want to post it for
others who may encounter this problem.
VC.NET is using an application manifest to enable visual styles within
the IDE with "devenv.exe". I don't know why but the problem cames from
that manifest file. To fix the problem, create a manifest file and name
it yourappname.exe.manifest
Paste this code into that file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="WindowsXP"
type="win32"
/>
<description>Your application description here.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
Now, use this file for any application you want to use XP styles for,
including VS.NET. You can put this manifest file in the .NET app
folder. Run VS.NET and you'll see xp styles. Make sure "flatstyle" for
your buttons and frames is set to "system".