Home Page
Articoli
Tips & Tricks
News
Forum
Archivio Forum
Blogs
Sondaggi
Rss
Video
Utenti
Chi Siamo
Contattaci
Username:
Password:
Login
Registrati ora!
Recupera Password
Home Page
Stanze Forum
App. WinForms / WPF .NET
Immagine anteprima C#
lunedì 14 settembre 2009 - 15.00
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
augusto890
Profilo
| Junior Member
161
messaggi | Data Invio:
lun 14 set 2009 - 15:00
Buongiorno a tutti,
io ho la necessità nel mio programma di recuperare l'iconcina di anteprima del file selezionato.
Proprio come fa windows quando selezioni un file .ppt o pdf...voi sapete se in .NET o altro esiste qualche classe che permette di fare un qualcosa di simile?
Grazie in anticipo, Luca
reru
Profilo
| Newbie
37
messaggi | Data Invio:
mar 15 set 2009 - 14:53
ciao, prova così
in un modulo
Private Structure SHFILEINFO
Public hIcon As IntPtr 'Icon
Public iIcon As Integer 'Icon Index
Public dwAttributes As Integer 'Flags
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> _
Public szDisplayName As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> _
Public szTypeName As String
End Structure
Public Function ExtractIcon(ByVal Pic As PictureBox, ByVal Path As String) As Long ', ByVal IconSize As IconSize
Try
Dim rImg As IntPtr
Dim shInfo As New SHFILEINFO
rImg = SHGetFileInfo(Path, 0, shInfo, Marshal.SizeOf(shInfo), &H100)
'Get Icon And Add It To Small ImageList
Dim eI As System.Drawing.Icon = System.Drawing.Icon.FromHandle(shInfo.hIcon)
Pic.Image = eI.ToBitmap
Catch ex As Exception
Pic.Image = Nothing
Exit Function
'MessageBox.Show("Error: " & ex.Message, "Titolo", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Function
ciao
RZ
Torna su
Stanze Forum
Elenco Threads
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?
Dopo esserti registrato potrai chiedere
aiuto sul nostro
Forum
oppure aiutare gli altri
Consulta le
Stanze
disponibili.
Registrati ora !