vb.net实现窗体阴影,怎么弄,谁会
这是在网上找的代码VB.NET窗体阴影Public Class Form1
Private Const CS_DROPSHADOW = &H20000
Private Const GCL_STYLE = (-26)
Private Declare Function GetClassLong Lib "user32" Alias "GetClassLongA" (ByVal hwnd As Integer, ByVal nIndex As Integer) As Integer
Private Declare Function SetClassLong Lib "user32" Alias "SetClassLongA" (ByVal hwnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As Long) As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SetClassLong(Me.Handle, GCL_STYLE, GetClassLong(Me.Handle, GCL_STYLE) Or CS_DROPSHADOW)
End Sub
End Class
这是网上找的代码,一用说:
读.user::SetClassLong”的调用导致堆栈不对称。原因可能是托管的 PInvoke 签名与非托管的目标签名不匹配。请检查 PInvoke 签名的调用约定和参数与非托管的目标签名是否匹配。
说是不匹配,网上说在VB.NET下可以使用 --------------------编程问答-------------------- api函数声明有问题。 --------------------编程问答-------------------- 那怎么声明呢, --------------------编程问答-------------------- Private Declare Function SetClassLong Lib "user32" Alias "SetClassLongA" (ByVal hwnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As Long) As Integer
=>
Private Declare Function SetClassLong Lib "user32" Alias "SetClassLongA" (ByVal hwnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer --------------------编程问答-------------------- VB6的integer是16bit的(和VB早期版本兼容,那时候操作系统、CPU都是16bit的),而long是32bit的。
现在32bit早就是基本类型了,VB.NET的integer是32bit的,long是64bit的。你这代码从哪里粘贴来的,估计是什么人抄了VB6的代码没有修改好就贴出来了。
所以,什么也不知道,就会“复制粘贴”你就得吃亏,遇到个乱贴程序挖坑的,你就傻了。 --------------------编程问答-------------------- http://wenwen.soso.com/z/q253445076.htm参考这个
这里面已经把long改成inter了
Public Declare Function GetClassLong Lib "user32" Alias "GetClassLongA" (ByVal hwnd As Integer, ByVal nIndex As Integer) As Integer
C#代码的话你通过http://www.developerfusion.com/ 转换成VB,NET
GOOD LUCK
补充:.NET技术 , VB.NET