CSkin博客

标题: 窗口继承CCSkinMain后,hide抛异常 [打印本页]

作者: whwei01    时间: 2015-8-19 17:18
标题: 窗口继承CCSkinMain后,hide抛异常
有一个窗口继承自CCSkinMain
public partial class VidyoLogin: CCSkinMain

当Hide的时候报了如下一个异常错误


异常详细内容如下
未处理 System.ComponentModel.Win32Exception
  Message=参数错误。
  Source=System.Windows.Forms
  ErrorCode=-2147467259
  NativeErrorCode=87
  StackTrace:
       在 System.Windows.Forms.Form.UpdateLayered()
       在 System.Windows.Forms.Form.set_Opacity(Double value)
       在 CCWin.CCSkinMain.JGMy3Yu6ZbtMCmMAiIM(Object , Double )
       在 CCWin.CCSkinMain.OnVisibleChanged(EventArgs e)
       在 System.Windows.Forms.Control.WmShowWindow(Message& m)
       在 System.Windows.Forms.Control.WndProc(Message& m)
       在 System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       在 System.Windows.Forms.Form.WmShowWindow(Message& m)
       在 System.Windows.Forms.Form.WndProc(Message& m)
       在 CCWin.CCSkinMain.WndProc(Message& m)
       在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       在 System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
       在 System.Windows.Forms.Control.SetVisibleCore(Boolean value)
       在 System.Windows.Forms.Form.SetVisibleCore(Boolean value)
       在 System.Windows.Forms.Control.Hide()
       在 VidyoLogin.VidyoLogin.LoginVideoPanel() 位置 E:\CTIL\SVNCTIL\CTIL830012\Trunk\Vidyo Demo\VidyoDemo\VidyoDemo\VidyoLogin.cs:行号 102
       在 System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
       在 System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
       在 System.Threading.ExecutionContext.runTryCode(Object userData)
       在 System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
       在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       在 System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
       在 System.Windows.Forms.Control.InvokeMarshaledCallbacks()
       在 System.Windows.Forms.Control.WndProc(Message& m)
       在 System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       在 System.Windows.Forms.Form.WndProc(Message& m)
       在 CCWin.CCSkinMain.WndProc(Message& m)
       在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       在 System.Windows.Forms.Application.Run(Form mainForm)
       在 VidyoLogin.Program.Main() 位置 E:\CTIL\SVNCTIL\CTIL830012\Trunk\Vidyo Demo\VidyoDemo\VidyoDemo\Program.cs:行号 18
       在 System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       在 System.Threading.ThreadHelper.ThreadStart()
  InnerException:

请高手解答一下,多谢



作者: 乔克斯    时间: 2015-8-20 09:11
试试this.Skin.hide();
或则关闭窗体Shadow阴影属性。
BUG已记录。
作者: whwei01    时间: 2015-8-21 10:15
乔克斯 发表于 2015-8-20 09:11
试试this.Skin.hide();
或则关闭窗体Shadow阴影属性。
BUG已记录。

帮主大人
按照你的方法试了下还是不行啊
特别说明下
这个hide方法是放在线程中执行的
作者: 乔克斯    时间: 2015-8-21 10:23
whwei01 发表于 2015-8-21 10:15
帮主大人
按照你的方法试了下还是不行啊
特别说明下

线程中执行需要委托主线程调用。
不能跨线程调用UI组件。
作者: whwei01    时间: 2015-8-21 11:46
乔克斯 发表于 2015-8-21 10:23
线程中执行需要委托主线程调用。
不能跨线程调用UI组件。

现在就是委托主线程调用的
作者: 乔克斯    时间: 2015-8-21 11:50
whwei01 发表于 2015-8-21 11:46
现在就是委托主线程调用的

不可能啊。。。
试试this.Skin.hide();
或则关闭窗体Shadow阴影属性。
之前很多人都是这2个问题。。就解决了。
或则你下载官网新版本试试。
www.cskin.net
作者: O.O    时间: 2015-12-7 12:58
我今天也遇到这个问题,找到原因了,TransparencyKey 属性去掉,这里只要设置了颜色或者透明就报错。

System.ComponentModel.Win32Exception (0x80004005): 参数错误。
   在 System.Windows.Forms.Form.UpdateLayered()
   在 System.Windows.Forms.Form.set_Opacity(Double value)
   在 CCWin.CCSkinMain.JGMy3Yu6ZbtMCmMAiIM(Object , Double )
   在 CCWin.CCSkinMain.OnVisibleChanged(EventArgs e)
   在 System.Windows.Forms.Control.WmShowWindow(Message& m)
   在 System.Windows.Forms.Control.WndProc(Message& m)
   在 System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   在 System.Windows.Forms.Form.WmShowWindow(Message& m)
   在 System.Windows.Forms.Form.WndProc(Message& m)
   在 CCWin.CCSkinMain.WndProc(Message& m)
   在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

QQ截图20151207125347.png (16.62 KB, 下载次数: 12)


作者: feiyuan    时间: 2020-12-24 19:08
谢谢答疑解惑,非常感谢
作者: feiyuan    时间: 2020-12-24 19:29
TransparencyKey 属性 右击点  重置,transparent也会报错,专门去试了下,真的是很大的bug,程序直接运行不了




欢迎光临 CSkin博客 (http://bbs.cskin.net/) Powered by Discuz! X3.2