在2012年我写信给
this thread
System.Runtime.InteropServices.HandleRef myHandleRef = new System.Runtime.InteropServices.HandleRef(this, this.Handle);
int myStyle = NativeMethods.GetClassLongPtr(myHandleRef, iGNativeMethods.CS_DROPSHADOW).ToInt32();
if (hasShadow)
myStyle |= NativeMethods.CS_DROPSHADOW;
else
myStyle &= ~NativeMethods.CS_DROPSHADOW;
NativeMethods.SetClassLong(myHandleRef, NativeMethods.GCL_STYLE, new IntPtr(myStyle));
Form myForm = new Form();
myForm.Show();
有没有另一种方法可以将CS_DROPSHADOW样式应用于现有表单而不会产生这种奇怪的副作用?