操作系统:Windows XP SP2
开发环境:VS2003以前,设计时在Windows设计器中控件是Win2000风格的,不知道是改了什么设置,现在设计器中的控件总是XP风格的,生成的程序必须要启用XP风格,而且要DoEvents,否则无法正常加载有ImageList的窗体,但这样一来,在Win2000下加载窗体又会出错.以前可以运行的程序,只要在现在的VS中再编译出来的就无法运行.记得好像在设计器的控件风格发生改变的那段时间,好像安装过VAssistX插件.我猜想可能是VS2003在加载插件时在启用了System.Windows.Forms.Application.EnableVisualStyles(),导致设计器设计时控件已经是XP风格.我正在验证这个想法是否正确,也请各位高手关注及解答这个问题.实在不行就用最蠢也是肯定有效的方法:重新安装VS2003或重装系统 :(
开发环境:VS2003以前,设计时在Windows设计器中控件是Win2000风格的,不知道是改了什么设置,现在设计器中的控件总是XP风格的,生成的程序必须要启用XP风格,而且要DoEvents,否则无法正常加载有ImageList的窗体,但这样一来,在Win2000下加载窗体又会出错.以前可以运行的程序,只要在现在的VS中再编译出来的就无法运行.记得好像在设计器的控件风格发生改变的那段时间,好像安装过VAssistX插件.我猜想可能是VS2003在加载插件时在启用了System.Windows.Forms.Application.EnableVisualStyles(),导致设计器设计时控件已经是XP风格.我正在验证这个想法是否正确,也请各位高手关注及解答这个问题.实在不行就用最蠢也是肯定有效的方法:重新安装VS2003或重装系统 :(
解决方案 »
- 求指导。、
- byte[]处理
- C# winFrom 使用了Developer控件,用什么工具能够加密?
- 救命啊,有没有人碰到过.net在VISTA下运行的兼容性问题啊 ?
- 又是一个结帖无分的帖
- 编译时怎么老是出现这种问题?
- 关于C#中注释以及显示文字自动完成等功能的不可用
- 照着vc#帮助写了个xml web server,在winform中调用,当“添加 web 引用”--http://localhost/authorswebservice/authorswebservice.vs
- 帮我看看这段从数据库读取数据的代码,我不知道是哪出错了.
- 菜单的继承
- VS2005 中的 Crystal Report Merge Modules 到哪去找啊? 高分相送!
- 求教C#如何写算法题目, 用递归算法实现。(C#语言)
Windows设计器也实现了XP主题是因为VS.IDE(..\Common7\IDE\devenv.exe)的目录下存在一个devenv.exe.manifest,如果删除它,重启VS.IDE就会恢复到Windows2000的主题,可是无法调试在支持XP主题时设计的窗体。所以你最好别去删除它!
最好的解决办法(再次感谢Sunmast)是:
不使用Application.EnableVisualStyles(),
在项目生成目录(..\Bin\)添加一个YourApp.exe.manifest文件
不使用Application.EnableVisualStyles(),
在项目生成目录(..\Bin\)添加一个YourApp.exe.manifest文件XP下运行没问题,Win2000下运行时加载有ImageList控件的窗体时仍会出错.
请教这应该如何解决.
just-in-time (JIT) debugging instead of this dialog box.************** Exception Text **************
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Failed to load ImageList.
at System.Windows.Forms.ImageListStreamer..ctor(SerializationInfo info, StreamingContext context)
--- End of inner exception stack trace ---
at System.Reflection.RuntimeConstructorInfo.SerializationInvoke(Object target, SerializationInfo info, StreamingContext context)
at System.Runtime.Serialization.ObjectManager.CompleteISerializableObject(Object obj, SerializationInfo info, StreamingContext context)
at System.Runtime.Serialization.ObjectManager.FixupSpecialObject(ObjectHolder holder)
at System.Runtime.Serialization.ObjectManager.DoFixups()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
at System.Resources.ResourceReader.LoadObject(Int32 pos)
at System.Resources.RuntimeResourceSet.GetObject(String key, Boolean ignoreCase)
at System.Resources.ResourceManager.GetObject(String name, CultureInfo culture)
at System.Resources.ResourceManager.GetObject(String name)
at DbCtrl.DbToolBarB.InitializeComponent()
at DbCtrl.DbToolBarB..ctor()
at SolomonSale.FrmSale..ctor()
at SolomonSale.FrmMDI.MimSale_Click(Object sender, EventArgs e)
at System.Windows.Forms.MenuItem.OnClick(EventArgs e)
at System.Windows.Forms.MenuItemData.Execute()
at System.Windows.Forms.Command.Invoke()
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/winnt/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
SolomonSale
Assembly Version: 1.0.2060.30348
Win32 Version: 1.0.2060.30348
CodeBase: file:///D:/Roy/Solomon/Sale20050822_3/SolomonSale.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/winnt/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/winnt/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/winnt/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 7.0.5000.0
Win32 Version: 7.10.3052.4
CodeBase: file:///c:/winnt/assembly/gac/microsoft.visualbasic/7.0.5000.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll
----------------------------------------
System.Data
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/winnt/assembly/gac/system.data/1.0.5000.0__b77a5c561934e089/system.data.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/winnt/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------
System.EnterpriseServices
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/winnt/assembly/gac/system.enterpriseservices/1.0.5000.0__b03f5f7f11d50a3a/system.enterpriseservices.dll
----------------------------------------
DbCtrl
Assembly Version: 1.0.2060.30341
Win32 Version: 1.0.2060.30341
CodeBase: file:///D:/Roy/Solomon/Sale20050822_3/DbCtrl.DLL
----------------------------------------************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.For example:<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
这个问题在Web下如何解决?
我上次发了一个贴子,结果问题没有解决!
不使用Application.EnableVisualStyles(),
在项目生成目录(..\Bin\)添加一个我的程序文件名.exe.manifest文件这个方法已经生效,已经可以看到XP样式的控件.但老问题仍然没有解决: Win2000下运行时加载有ImageList控件的窗体时出错也试过将:YourApp.exe.manifest文件内的name="DevEnv.exe"改为"我的程序文件名.exe",在Main()方法中加入DoEvents(),但问题依旧.
怎样做?