20/02/20 11:49
Thejuster
Ultima modifica effettuata da Thejuster 20/02/20 13:14
mire.forumfree.it/ - Mire Engine
C# UI Designer
C# UI Designer
OfD1.Filter = "Images(*.jpg *.bmp *.png *.gif *.tif)|*.jpg;*.bmp;*.png;*.gif;*.tif|Tutti i file (*.*)|*.*"
AddHandler p.Click, AddressOf P_Click
For Each FileName In files Npbx += Npbx '-------------------------------------- incremento l'indice della pic ''Nlab = Npic pic(Npbx) = New PictureBox '------------------ creo una nuova picturebox pic(Npbx).BackColor = Color.Gray '---------- colore della fondo che rimarrà visibile ( cornice ) pic(Npbx).Size = New System.Drawing.Size(Wpic, Hpic) '----- Dimensione PictureBox = ( 120 x 80 ) pic(Npbx).Location = New Point(xpic, ypic) pic(Npbx).Image = Image.FromFile(FileName) Dim bm_source As New Bitmap(FileName) '-------------- ridimensionamento immagine ---------------- Dim bm_dest As New Bitmap(CInt(bm_source.Width * Wfdim), CInt(bm_source.Height * Hfdim)) '--- In questo caso Size sarà: Wfdim = 0,0503 e Hfdim = 0,0455 Dim gr_dest As Graphics = Graphics.FromImage(bm_dest) gr_dest.DrawImage(bm_source, ximg, yimg, bm_dest.Width, bm_dest.Height) '--- In questo caso Location sarà: ximg = 5 e yimg = 5 '---------------------------------------------------------- Dimensioni dell'immagine risultante = ( 115 x 76 ) pic(Npbx).Image = bm_dest '------- caricamento dell'immagine in PictureBox
Dim Path as string = "G:\Ilmiofotoalbum"" Dim ofd1 As OpenFileDialog = New OpenFileDialog() ofd1.InitialDirectory = Path ofd1.Multiselect = True ofd1.Filter = "All files|*.*" ofd1.FilterIndex = 2 ofd1.RestoreDirectory = True If ofd1.ShowDialog() = DialogResult.OK Then If Not FlowLayoutPanel1.Controls.Count = 0 Then Dim iRisp As Integer iRisp = MsgBox(" Nel Pannello sono già presenti altre immagini," & vbCrLf & vbCrLf & _ " [ SI ] Aggiunge le nuove immagini" & vbCrLf & vbCrLf & _ " [ NO ] Cancella le immagini presenti.", 3 + 32) Select Case iRisp Case vbYes Case vbNo FlowLayoutPanel1.Controls.Clear() Case Else Exit Sub End Select End If Dim files() As String = ofd1.FileNames Dim filetit As System.IO.FileInfo For Each FileName In files Dim p As Panel = New Panel() p.Size = New Size(wpan, hpan) '.............. (130, 115) p.BackColor = Color.Silver p.BorderStyle = BorderStyle.FixedSingle Dim b As Bitmap = New Bitmap(wpan, hpan) '.............. (130, 115) Dim img As Image = Image.FromFile(FileName) Dim gr As Graphics = Graphics.FromImage(b) gr.DrawImage(img, ximg, yimg, wimg, himg) '................(4, 4, 120, 90) p.BackgroundImage = b p.Tag = FileName Dim labtit As New Label '--------------------------------------------- realizzazione label titolo immagine labtit.BackColor = Color.Beige filetit = My.Computer.FileSystem.GetFileInfo(FileName) '--------- rilevamento titolo immagine labtit.Text = (filetit.Name) labtit.Font = New Font(ftxt, htxt) '.................... ("Microsoft Sans Serif", 7) labtit.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D labtit.Size = New System.Drawing.Size(wpan, hlab) '................ (130, 15) labtit.Location() = New Point(xlab, hpan - hlab - 3) '.................. (0, 115 - 15 - 3) FlowLayoutPanel1.Controls.Add(p) p.Controls.Add(labtit) img.Dispose() p.Cursor = Cursors.Hand AddHandler p.Click, AddressOf P_Click '---------------------- selezione immagone per ingrandimento AddHandler p.DoubleClick, AddressOf P_2Click '----------- selezione immagone per catalogazione Private Sub P_Click(ByVal sender As Object, ByVal e As EventArgs) Dim img As Image = Image.FromFile((CType(sender, Panel)).Tag.ToString()) PictureBox1.BackgroundImage = img PictureBox1.BackgroundImageLayout = ImageLayout.Stretch End Sub Private Sub P_2Click(ByVal sender As Object, ByVal e As EventArgs) '------------------ da implementare ------------------- End Sub
Public Sub sb310() '---------------------------------- [ sb310 ] 'lmefotoalbum ---------------------- 200217 'MsgBox("sb310") 'Exit Sub ' Dim Path As String = "C:\" ' meglio ometterla Dim ofd1 As OpenFileDialog = New OpenFileDialog() ' ofd1.InitialDirectory = Path ' meglio ometterla ofd1.Multiselect = True ' ***** FILTRO PER TUTTE LE IMMAGINI ******** ofd1.Filter = "Images(*.jpg *.bmp *.png *.gif *.tif)|*.jpg;*.bmp;*.png;*.gif;*.tif|Tutti i file (*.*)|*.*" ' **************************************** ofd1.FilterIndex = 2 '...... '...... '...... '......