Online to find an article on programming "VB production slide player"
Address: http://www.doc88.com/p-9394448228185.html
Appeared in the process of running "compiler error, the variable is undefined", as the chart,
Ask how to modify the code, says it is not defined file1.
![](https://img.codepudding.com/202009/103064250722361.jpg)
![](https://img.codepudding.com/202009/103064250722362.jpg)
Interface is as follows:
![](https://img.codepudding.com/202009/103064250722363.jpg)
The complete code is as follows:
Option Explicit
Dim the Message, the Title, the Default, MyValue
Dim Pi
Dim As Integer I
Private Sub Image3_Click ()
End
End Sub
Private Sub Image4_Click ()
Image2. Visible=False
If Pi=0 Then
MsgBox (" welcome!" )
The Else
Pi Pi=1
End the If
Image1. Stretch=False
Image1. Visible=False
Image1. Picture=LoadPicture (App) Path + "" + File1) List (Pi))
If Image1. Height & gt; Form1. Height Then
Image1. Width=Image1. Width * Form1. Height/Image1. Height
Image1. Height=Form1. Height
Image1. Stretch=True
Image1. Move (Form1. Width - Image1. Width)/2, 0
The Else
Image1. Move (Form1. Width - Image1. Width)/2, (Form1. Height - Image1. Height)/2
End the If
Image1. Visible=True
End Sub
Private Sub Form_Click ()
Image2. Visible=False
Then the If Pi=File1. ListCount - 1
MsgBox (" thank you for watching!" )
The Else
Pi Pi + 1=
End the If
Image1. Stretch=False
Image1. Visible=False
Image1. Picture=LoadPicture (App) Path + "" + File1) List (Pi))
If Image1. Height & gt; Form1. Height Then
Image1. Width=Image1. Width * Form1. Height/Image1. Height
Image1. Height=Form1. Height
Image1. Stretch=True
Image1. Move (Form1. Width - Image1. Width)/2, 0
The Else
Image1. Move (Form1. Width - Image1. Width)/2, (Form1. Height - Image1. Height)/2
End the If
Image1. Visible=True
End Sub
Private Sub Form_Load ()
Form1. Move 0, 0, Screen Width, Screen. Height
File1. Path=App. Path
File1. The Pattern=(*. BMP;" * JPG. * GIF ")
Image2. Visible=False
Image1. Stretch=False
Image1. Visible=False
Image1. Picture=LoadPicture (App) Path + "" + File1) List (0))
If Image1. Height & gt; Form1. Height Then
Image1. Width=Image1. Width * Form1. Height/Image1. Height
Image1. Height=Form1. Height
Image1. Stretch=True
Image1. Move (Form1. Width - Image1. Width)/2, 0
The Else
Image1. Move (Form1. Width - Image1. Width)/2, (Form1. Height - Image1. Height)/2
End the If
Text1. Visible=False
Image1. Visible=True
Image3. Move (Form1. Width - Image3. Width), (Form1. Height - Image4. Height * 2)
Image4. Move (Form1. Width - Image3. Width), (Form1. Height - Image4. Height)
Text1. Move (Form1. Width - Text1. Width)/2, (Form1. Height - Text1. Height * 2)
End Sub
Private Sub Form_MouseMove (Button As an Integer, shift the As an Integer, As Single X, Y As Single)
Text1. Visible=False
End Sub
Private Sub Image1_MouseMove (Button As an Integer, shift the As an Integer, As Single X, Y As Single)
Text1. Visible=True
Text1. Text=File1. List (Pi)
End Sub
Private Sub Image1_Click ()
Dim Msg, Style, Title, help, Ctxt, Response, mystring
Image2. Visible=False
Then the If Pi=File1. ListCount - 1
Msg="thanks for watching!"
Style=vbYesNo + vbDefaultButton2
Title="play!"
Help="DEMO. HLP
"Ctxt=1000
The Response=MsgBox (Mag, Style, Title, help, Ctxt)
If the Response=vbYes Then
Mystring="Yes"
End
The Else
Mystring="No"
End the If
The Else
Pi Pi + 1=
End the If
Image1. Stretch=False
Image1. Visible=False
Image1. Picture=LoadPicture (App) Path + "" + File1) List (Pi))
If Image1. Height & gt; Form1. Height Then
Image1. Width=Image1. Width * Form1. Height/Image1. Height
Image1. Height=Form1. Height
Image1. Stretch=True
Image1. Move (Form1. Width - Image1. Width)/2, 0
The Else
Image1. Move (Form1. Width - Image1. Width)/2, (Form1. Height - Image1. Height)/2
End the If
Image1. Visible=True
End Sub
CodePudding user response:
Preliminary observation should be the file control, drag a to form...CodePudding user response: