[Tutorial]Picture Converter
You Need
2 Buttons ( Button 1 "Open File" Button 2 "Convert To")
1 ComboBox ( Add PNG JPEG GIF BMP ICO)
1 Label
1 Picture Box
1 OpenFileDialog
1 SaveFileDialog
Now add the Following Code to Open File Button
PHP Code:
Now Add the Following Code to Convert to Button
PHP Code:
2 Buttons ( Button 1 "Open File" Button 2 "Convert To")
1 ComboBox ( Add PNG JPEG GIF BMP ICO)
1 Label
1 Picture Box
1 OpenFileDialog
1 SaveFileDialog
Now add the Following Code to Open File Button
PHP Code:
Code:
Code:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Try If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then PictureBox1.Image = System.Drawing.Image.FromFile(OpenFileDialog1.FileName) End If Catch ex As Exception End Try End Sub
Now Add the Following Code to Convert to Button
PHP Code:
Code:
Code:If ComboBox1.SelectedItem = "JPEG" Then SaveFileDialog1.Filter = "JPEG |*.jpg" Try If SaveFileDialog1.ShowDialog = DialogResult.OK Then PictureBox1.Image.Save(SaveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Jpeg) End If Catch ex As Exception End Try End If Try If ComboBox1.SelectedItem = "ICO" Then SaveFileDialog1.Filter = "ICO |*.ico" If SaveFileDialog1.ShowDialog = DialogResult.OK Then PictureBox1.Image.Save(SaveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Icon) End If End If Catch ex As Exception End Try If ComboBox1.SelectedItem = "PNG" Then SaveFileDialog1.Filter = "PNG |*.png" Try If SaveFileDialog1.ShowDialog = DialogResult.OK Then PictureBox1.Image.Save(SaveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Png) End If Catch ex As Exception End Try End If If ComboBox1.SelectedItem = "GIF" Then SaveFileDialog1.Filter = "GIF |*.gif" Try If SaveFileDialog1.ShowDialog = DialogResult.OK Then PictureBox1.Image.Save(SaveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Gif) End If Catch ex As Exception End Try End If If ComboBox1.SelectedItem = "BMP" Then SaveFileDialog1.Filter = "BMP |*.bmp" Try If SaveFileDialog1.ShowDialog = DialogResult.OK Then PictureBox1.Image.Save(SaveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Bmp) End If Catch ex As Exception End Try End If End Sub