Hi Everyone,
Does any have or know of a Picture slide show done in Gambas?
Picture slide show
Re: Picture slide show
...by using a Picture[ ] or Image[ ] array...
Europaeus sum !
Amare memorentes atque deflentes ad mortem silenter labimur.
Amare memorentes atque deflentes ad mortem silenter labimur.
-
- Posts: 363
- Joined: Wednesday 2nd December 2020 12:11am
- Location: Northampton, England
- Contact:
Re: Picture slide show
Could that be controlled by a timer? To say loop though each pic and show it for 20 seconds at a time?
Re: Picture slide show
Of course, try it.
Europaeus sum !
Amare memorentes atque deflentes ad mortem silenter labimur.
Amare memorentes atque deflentes ad mortem silenter labimur.
-
- Posts: 363
- Joined: Wednesday 2nd December 2020 12:11am
- Location: Northampton, England
- Contact:
Re: Picture slide show
I will thanks for the advice
- BruceSteers
- Posts: 1618
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Picture slide show
Should be simple. Something like..
Add a PictureBox called PictureBox1 and a timer called PictureTimer...
(I typed this on my phone at work so could be errors, just an example)
Add a PictureBox called PictureBox1 and a timer called PictureTimer...
Public ListPos As Integer
Public dirList As String[]
Public Sub startshow(Folder As String)
ListPos = 0
dirList = []
Dim files as String[] = Dir(Folder)
For Each s As String In files
Dim ext As String = File.Ext(s)
If ext = "jpg" Or Ext = "png" Then dirList.Add(s)
Next
PictureTimer.Start
End
Public Sub PictureTimer_Timer()
PictureBox1.Picture = Picture.Load(dirList[ListPos])
If Listpos = dirList.Max then ListPos = 0 Else Inc ListPos
End
Something like that (I typed this on my phone at work so could be errors, just an example)
If at first you don't succeed , try doing something differently.
BruceS
BruceS
-
- Posts: 363
- Joined: Wednesday 2nd December 2020 12:11am
- Location: Northampton, England
- Contact:
Re: Picture slide show
Thanks Bruce it will give me something to start with
- cogier
- Site Admin
- Posts: 1129
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: Picture slide show
Run this code in a new Graphical Application. It assumes you have some .jpg files in your Pictures folder.
sPath As String = User.Home &/ "Pictures"
sPictures As String[] = Dir(sPath, "*.jpg")
iCount As Integer
PictureBox1 As PictureBox
Timer1 As Timer
Public Sub Form_Open()
BuildForm
End
Public Sub Timer1_Timer()
Try PictureBox1.Picture = Picture.Load(sPath &/ sPictures[iCount])
Me.Text = sPictures[iCount]
Inc iCount
If iCount = sPictures.Count Then iCount = 0
End
Public Sub BuildForm()
With Me
.Height = 700
.Width = 1000
.Padding = 5
.Arrangement = Arrange.Vertical
.Center
End With
With PictureBox1 = New PictureBox(Me) As "PictureBox1"
.Expand = True
.Mode = PictureBox.Contain
.Alignment = Align.Center
End With
With Timer1 = New Timer As "Timer1"
.Enabled = True
.Delay = 2000
End With
End