تصویر اگه یکسری فایل ئه که از تو یه فولدر لیستش رو میخونید...
کد:
Imports System.IO
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ImageList1.Images.Clear()
ImageList1.ImageSize = New Size(128, 128)
ListView1.Items.Clear()
ListView1.LargeImageList = ImageList1
Dim files = Directory.GetFiles("E:\Photo Folder", "*.jpg")
For Each file In files
Try
Using img = Image.FromFile(file)
Dim thumb = img.GetThumbnailImage(128, 128, Nothing, IntPtr.Zero)
Dim filename = Path.GetFileName(file)
ImageList1.Images.Add(file, thumb)
ListView1.Items.Add(filename, file)
End Using
Catch ex As Exception
End Try
Next
End Sub
Private Sub ListView1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListView1.SelectedIndexChanged
If ListView1.SelectedItems.Count = 0 Then Exit Sub
Dim file = ListView1.SelectedItems(0).ImageKey
Try
If PictureBox1.Image IsNot Nothing Then PictureBox1.Image.Dispose()
PictureBox1.Image = Image.FromFile(file)
Catch ex As Exception
PictureBox1.Image = Nothing
End Try
End Sub
End Class
WindowsApp4.zip
یک دنیا ممنون از شما
واقعا فقط مجید انلان و شما تو کل انجمن ها جواب مارو با لطف و مهربونی میدین.
...........
فقط سوال اخررم
من فرم رو میخوام کامل پرینت بگیرم.عمودی پرینت میگیره و کل فرم داخل نمیاد.
کامپونت powerpack هم نصب میکنم داخل vb نمیاد که ازش استفاده کنم.من از کد زیر استفاده کردم
Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim b As New Bitmap(Me.Height, Me.Width)
Me.DrawToBitmap(b, New Rectangle(0, 0, Me.Height, Me.Width))
e.Graphics.DrawImage(b, New Point(0, 0))
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
PrintDialog1.ShowDialog()
PrintDocument1.Print()
End Sub