我想做一个VB程序 一点开就可以自动播放选定的图片一张一张放 最好是全屏的要放几百张图片

我想做一个VB程序 一点开就可以自动播放选定的图片一张一张放 最好是全屏的要放几百张图片,第1张

把照片从1-520 编号号码

Option Explicit

Private Sub Form_Load()

MeWidth = ScreenWidth

MeHeight = ScreenHeight

MeTop = 0

MeLeft = 0

Image1Top = 0

Image1Left = 0

Image1Width = MeWidth

Image1Height = MeHeight

End Sub

Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Shift = 2 Then

Unload Me

End If

End Sub

Private Sub Timer1_Timer()

Static i As Integer

Dim f As String

i = i + 1

If i = 521 Then i = 1

f = AppPath & "\" & i & "jpg"

Image1Picture = LoadPicture(f)

End Sub

新建一个窗体,在窗体上添加一个命令按钮,然后在代码窗口中添加以下代码:

===============================================

Private

Sub

Command1_Click()

Const

msg1

As

String="请在这里输入你想显示的一段话!"

Const

msg2

As

String="这里是对话框要显示的标题"

MsgBox

msg1,vbOkOnly,msg2

'此处代码一定不能添加()

End

Sub

===============================================

记住,1楼的代码会出现编译错误,在不需要返回值的时候就不能添加(),而在需要返回值的时候就一定要添加()

你的描述我不是很明白,可以给你个思路!首先找个爱心形状的,加载进窗体的picturebox中,调整到合适大小。然后用以下让窗体透明。'设置MeBorderStyle = 0

Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long

Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long

Private Const WS_EX_LAYERED = &H80000

Private Const GWL_EXSTYLE = (-20)

Private Const LWA_ALPHA = &H2

Private Const LWA_COLORKEY = &H1

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 Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Private Sub Form_Load()

MeBackColor = &HFF0000

Dim rtn As Long

rtn = GetWindowLong(hwnd, GWL_EXSTYLE)

rtn = rtn Or WS_EX_LAYERED

SetWindowLong hwnd, GWL_EXSTYLE, rtn

SetLayeredWindowAttributes hwnd, &HFF0000, 0, LWA_COLORKEY

End Sub

欢迎分享,转载请注明来源:表白网

原文地址:https://h5.hunlipic.com/biaobai/2919764.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2024-01-21
下一篇2024-01-21

发表评论

登录后才能评论

评论列表(0条)

    保存