Salve a Tutti
Ho questo Problema in questo codice:
è un percorso fisso.
io vorrei come collegarlo ad un drivelistbox e ad un dirlistbox
Ma ho provato in vari modi ma non ci riesco qualcuno sa darmi un consiglio?
il codice è il seguente Basta copiarlo in un Bloc note e poi salvarlo frmPreview.frm e aprirlo
con Visual.
codice:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MsComCtl.ocx"
Begin VB.Form frmPreview
Caption = "Form1"
ClientHeight = 6510
ClientLeft = 60
ClientTop = 375
ClientWidth = 8595
LinkTopic = "Form1"
ScaleHeight = 6510
ScaleWidth = 8595
StartUpPosition = 3 'Windows Default
Begin VB.PictureBox Picture1
Height = 825
Left = 3435
ScaleHeight = 765
ScaleWidth = 945
TabIndex = 2
Top = 180
Visible = 0 'False
Width = 1005
End
Begin MSComctlLib.ImageList ilsAnteprime
Left = 2205
Top = 180
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
MaskColor = 12632256
_Version = 393216
End
Begin MSComctlLib.ListView lvwElenco
Height = 5160
Left = 210
TabIndex = 1
Top = 1065
Width = 8115
_ExtentX = 14314
_ExtentY = 9102
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 0
End
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 420
Left = 195
TabIndex = 0
Top = 315
Width = 1515
End
End
Attribute VB_Name = "frmPreview"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim FSO As Object
Private Sub Command1_Click()
Dim FLD As Object
Dim IMG As Object
Dim tmpImg As StdPicture
Set FLD = FSO.GetFolder("E:\Grafica\Images\Immagini")
lvwElenco.ColumnHeaders.Add , , "Anteprima", 3000
lvwElenco.View = lvwReport
On Error Resume Next
W = 128 * Screen.TwipsPerPixelX
H = 96 * Screen.TwipsPerPixelY
Picture1.Width = W
Picture1.Height = H
ilsAnteprime.ListImages.Add , , Picture1.Image
Set lvwElenco.SmallIcons = ilsAnteprime
For Each IMG In FLD.Files
Set tmpImg = LoadPicture(IMG.Path)
Picture1.BorderStyle = 0
Picture1.AutoRedraw = True
Picture1.PaintPicture tmpImg, 0, 0, W, H
ilsAnteprime.ListImages.Add , , Picture1.Image
lvwElenco.ListItems.Add , , IMG.Name, , ilsAnteprime.ListImages.Count
DoEvents
Next
End Sub
Private Sub Form_Load()
Set FSO = CreateObject("Scripting.FileSystemObject")
End Sub
Grazie Anticipatamente
il Vostro tony.hood