怎么把vb窗体变成自己的图片、十万火急!!!!!
3个回答
展开全部
在你设计的程序目录下先保存一张图片,格式只能为为bmp,dib,jpg,gif,wmf,emf,ico,cur,除此外若你选择“所有文件”的选项所添加的图片是无效的,VB无法识别。
设置好picture属性后在设置下borderstyle属性为“0-none ”再加入一段API函数是无标题栏窗口可以单击并拖动窗口内容移动。
代码如下:
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long,
ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_NCLBUTTONDOWN = &&HA1
Private Const HTCAPTION = 2
'以上API函数和常数的声明可在VB自带的“API浏览器”中找到
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'在窗体的MouseDown事件中添加以下代码
If Button = 1 Then
Call ReleaseCapture
Call SendMessage(hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0)
End If
End Sub
Private Sub Command1_Click()
End '退出程序
End Sub
窗体被拖动时与普通窗体一样,只有一个虚框随鼠标的移动而移动,当释放鼠标时窗体才移动到相应的位置。用到了两个API函数。
设置好picture属性后在设置下borderstyle属性为“0-none ”再加入一段API函数是无标题栏窗口可以单击并拖动窗口内容移动。
代码如下:
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long,
ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_NCLBUTTONDOWN = &&HA1
Private Const HTCAPTION = 2
'以上API函数和常数的声明可在VB自带的“API浏览器”中找到
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'在窗体的MouseDown事件中添加以下代码
If Button = 1 Then
Call ReleaseCapture
Call SendMessage(hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0)
End If
End Sub
Private Sub Command1_Click()
End '退出程序
End Sub
窗体被拖动时与普通窗体一样,只有一个虚框随鼠标的移动而移动,当释放鼠标时窗体才移动到相应的位置。用到了两个API函数。
参考资料: JayKise.Studio
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询