사용자가 그림 폴더를 선택하면 해당 폴더를 레지스트리에 저장하십시오. 프로그램이로드되면 레지스트리에서 폴더를 가져옵니다.
SaveSetting ("mayappname","settings","picturefolder",PicFolderName)
과 함께 프로그램을로드 폴더 복원 : 이 같은 저장할 수 있습니다
Dim PicFolderName As String = GetSetting("mayappname", "settings", "picturefolder", My.Computer.FileSystem.SpecialDirectories.MyDocuments)
이 예는 모든 45초에 폴더 변경 이미지의 모든 JPG-이미지를 읽고을 폴더의 다음 이미지. 사용자가 20 개의 이미지를 선택하고 그 사이를 회전 할 수있게하려면 알려주세요. 그러면 사용자가 선택한 모든 그림을 저장하고 그 사이에서만 회전해야합니다. 그러나이 코드는 선택한 폴더의 모든 그림 사이를 회전합니다.
사용자가 선택한 그림으로 작업하는 방법을 변경하는 방법을 알고 계신 것 같습니다. 그 답을주지 않을 것입니다. 여러 가지 방법으로 할 수 있기 때문에 사용자와 프로그램 간의 상호 작용을 원하는 방식으로 추가 정보가 필요하기 때문입니다.
음.
Private ImageNames As New List(Of String)
Private ImageIndexNow As Integer = 0
Private PictureTimer As New Timer
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Get the saved path for where the images are stored.
Dim PicFolderName As String = GetSetting("mayappname", "settings", "picturefolder", My.Computer.FileSystem.SpecialDirectories.MyDocuments)
'PicFolderName="c:\mypictures" ' remove rem if you just want to test with a specific folder
'Call sub that read in all names of images in that path.
LoadImageNames(PicFolderName)
PictureTimer.Interval = 45000 '45 seconds
PictureTimer.Enabled = True
AddHandler PictureTimer.Tick, AddressOf PictureTimer_Tick
End Sub
Sub LoadImageNames(ByVal ImagePath As String)
'Load image names in a list of strings for the provided Imagepath
For Each file As String In IO.Directory.GetFiles(ImagePath , "*.jpg")
ImageNames.Add(file)
Next
End Sub
Private Sub PictureTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
'set background image of the form to image number imageIndexNow in the list of images
Me.BackgroundImageLayout = ImageLayout.Stretch
Me.BackgroundImage = Image.FromFile(ImageNames(ImageIndexNow))
ImageIndexNow += 1 ' Add one to the number so next picture is selected next time the timer-tick is fired.
If ImageIndexNow > ImageNames.Count-1 Then ImageIndexNow = 0 ' Start from zero if imageIndexNow is larger than amount of images.
End Sub
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
RemoveHandler PictureTimer.Tick, AddressOf PictureTimer_Tick
End Sub
만 사이에 회전이 설정을 변경하려면 다음 레지스트리 폴더를 저장하는 코드가있는 경우, 다음 선택한 폴더의 사진에서 모든 45초이 사진을 변경하는 양식이 붙여 넣기 사용자가 선택한 20 개의 그림을 선택하면 해당 그림 이름을 ImageNames 목록에 저장하도록 프로그램을 변경하십시오. 그런 다음이 목록 eather를 레지스트리, 파일 또는 데이터베이스에 저장하십시오. 프로그램이로드 될 때 목록을 복원하면 위 코드를 전혀 변경하지 않고 사용할 수 있습니다.
Windows Forms, Web Forms 또는 무엇을 사용하고 있습니까? –
귀하의 앱에 대한 배경을 말한 것입니다. 맞습니까? 이제 전체 Windows 데스크톱? –
@ John Saunders for Windows Form –