Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
[COLOR=blue]Public Function NewLoadPicture(strPath As String) As StdPicture
With CreateObject("WIA.ImageFile")
.LoadFile (strPath)
Set NewLoadPicture = .FileData.Picture
End With
End Function[/color]
Option Explicit
Private Sub Form_Load()
'[URL unfurl="true"]https://www.tek-tips.com/viewthread.cfm?qid=1819138[/URL]
Set Picture1.Picture = NewLoadPicture("C:\Lavori_Vb6\BANDIERE\FLAG\country-flags-main\png1000px\ad.png")
End Sub
Public Function NewLoadPicture(strPath As String) As StdPicture
With CreateObject("WIA.ImageFile")
.LoadFile (strPath)
Set NewLoadPicture = .FileData.Picture
End With
End Function
[COLOR=blue]Public Function NewLoadPicture(strPath As String[b], Optional NewX As Long, Optional NewY As Long[/b]) As StdPicture
[b]Dim img As Object
Set img = CreateObject("WIA.ImageFile")[/b]
With [b]img[/b]
.LoadFile strPath
[COLOR=green][b] ' In production code we would also want to do some more rigorous checking of
' NewX and NewY to ensure legit values[/color]
If NewX <> 0 And NewY <> 0 Then
With CreateObject("WIA.ImageProcess")
[COLOR=green]' Resample/scale to NewX x NewY[/color]
.Filters.Add .FilterInfos!Scale.FilterID
With .Filters(1).Properties
!PreserveAspectRatio = False
!MaximumWidth = NewX
!MaximumHeight = NewY
End With
Set img = .Apply(img)
End With
End If[/b]
Set NewLoadPicture = [b]img[/b].FileData.Picture
End With
End Function
[/color]