Image Convert : Image « 2D Graphics « VB.Net Tutorial

VB.Net Tutorial
1. Language Basics
2. Data Type
3. Operator
4. Statements
5. Date Time
6. Class Module
7. Development
8. Collections
9. Generics
10. Attributes
11. Event
12. Stream File
13. GUI
14. GUI Applications
15. 2D Graphics
16. I18N Internationlization
17. Reflection
18. Regular Expressions
19. Security
20. Socket Network
21. Thread
22. Windows
23. XML
24. Database ADO.net
25. Design Patterns
Microsoft Office Word 2007 Tutorial
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial » 2D Graphics » Image 
15. 52. 3. Image Convert
Image Convert
 

Imports System
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data
Imports System.Drawing.Imaging


public class ImageConverter
   public Shared Sub Main
        Application.Run(New Form1)
   End Sub
End class

Public Class Form1
    Inherits System.Windows.Forms.Form
    Private curImage As Image

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is NothingThen
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents SaveFormatCombo As System.Windows.Forms.ComboBox
    Friend WithEvents ConvertToBtn As System.Windows.Forms.Button
    Friend WithEvents ViewImgBtn As System.Windows.Forms.Button
    Friend WithEvents pictureBox1 As System.Windows.Forms.PictureBox
    <System.Diagnostics.DebuggerStepThrough()Private Sub InitializeComponent()
        Me.SaveFormatCombo = New System.Windows.Forms.ComboBox
        Me.ConvertToBtn = New System.Windows.Forms.Button
        Me.ViewImgBtn = New System.Windows.Forms.Button
        Me.pictureBox1 = New System.Windows.Forms.PictureBox
        Me.SuspendLayout()
        '
        'SaveFormatCombo
        '
        Me.SaveFormatCombo.Items.AddRange(New Object() {"bmp""jpg""wmf""gif""emf"})
        Me.SaveFormatCombo.Location = New System.Drawing.Point(404214)
        Me.SaveFormatCombo.Name = "SaveFormatCombo"
        Me.SaveFormatCombo.Size = New System.Drawing.Size(9621)
        Me.SaveFormatCombo.TabIndex = 7
        Me.SaveFormatCombo.Text = "bmp"
        '
        'ConvertToBtn
        '
        Me.ConvertToBtn.Location = New System.Drawing.Point(404182)
        Me.ConvertToBtn.Name = "ConvertToBtn"
        Me.ConvertToBtn.Size = New System.Drawing.Size(9624)
        Me.ConvertToBtn.TabIndex = 6
        Me.ConvertToBtn.Text = "Convert Now"
        '
        'ViewImgBtn
        '
        Me.ViewImgBtn.Location = New System.Drawing.Point(40438)
        Me.ViewImgBtn.Name = "ViewImgBtn"
        Me.ViewImgBtn.Size = New System.Drawing.Size(8824)
        Me.ViewImgBtn.TabIndex = 5
        Me.ViewImgBtn.Text = "View Image"
        '
        'pictureBox1
        '
        Me.pictureBox1.Location = New System.Drawing.Point(430)
        Me.pictureBox1.Name = "pictureBox1"
        Me.pictureBox1.Size = New System.Drawing.Size(368328)
        Me.pictureBox1.TabIndex = 4
        Me.pictureBox1.TabStop = False
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(513)
        Me.ClientSize = New System.Drawing.Size(504389)
        Me.Controls.Add(Me.SaveFormatCombo)
        Me.Controls.Add(Me.ConvertToBtn)
        Me.Controls.Add(Me.ViewImgBtn)
        Me.Controls.Add(Me.pictureBox1)
        Me.Name = "Form1"
        Me.Text = "GDI+ Image Convertor"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub ViewImgBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgsHandles ViewImgBtn.Click
        Dim openDlg As New OpenFileDialog   '
        openDlg.Filter = "All Image files|*.bmp;*.gif;*.jpg;*.ico;*.emf,*.wmf|Bitmap Files(*.bmp;*.gif;*.jpg;*.ico)|*.bmp;*.gif;*.jpg;*.ico|Meta Files(*.emf;*.wmf)|*.emf;*.wmf"
        Dim filter As String = openDlg.Filter
        openDlg.InitialDirectory = Environment.CurrentDirectory
        openDlg.Title = "Open Image File"
        openDlg.ShowHelp = True
        If openDlg.ShowDialog() = DialogResult.OK Then
            curImage = Image.FromFile(openDlg.FileName)
            pictureBox1.Width = curImage.Width
            pictureBox1.Height = curImage.Height
            pictureBox1.Image = curImage
            pictureBox1.Visible = True
        End If
    End Sub

    Private Sub ConvertToBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgsHandles ConvertToBtn.Click
        Dim imgStream As New System.IO.MemoryStream
        Dim imgConverter As New ImageConverter
    End Sub
End Class

        
15. 52. Image
15. 52. 1. Image PropertiesImage Properties
15. 52. 2. Get Image PropertyItems
15. 52. 3. Image ConvertImage Convert
15. 52. 4. Save Image with different sizeSave Image with different size
w__w__w.__j__a__v_a_2__s.___c_o_m_ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.