.:: Jasa Membuat Aplikasi Website,Desktop,Android Order Now..!! | | Order Now..!! Jasa Membuat Project Arduino,Robotic,Print 3D ::.

How Convert Bmp To Icon in VBNET?

0 komentar


بِسْــــــــــــــــمِ اﷲِالرَّحْمَنِ اارَّحِيم
bismillaahirrahmaanirrahiim

السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
Assalamu'alaikum warahmatullahi wabarakatuh

How Convert Bmp To Icon in VBNET?


Convert Bitmap picture and any image to icon with this sample application. Converting image becomes very simple. If you need to save the icon file, you just need to program and modify the sample code.

I made the sample code using Microsoft Visual Basic 2010.




Imports System.Security.Permissions ' for SecurityPermissionAttribute

''' <summary>
''' Author : Check-Kay Wong
'''
''' Description: Simple application to Convert a BITMAP to ICON in VBNET
'''
''' Anwser a question from : http://www.dreamincode.net/forums/topic/323139-how-convert-bmp-to-icon/
''' reference to : http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.gethicon(v=vs.100).aspx
''' </summary>
''' <remarks></remarks>
Public Class Form1

    'Declaration
    <SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags:=SecurityPermissionFlag.UnmanagedCode)> _
    Public Function GetHicon() As IntPtr

    End Function
    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim oOpenFileDialog As OpenFileDialog
        Dim oSaveFileDialog As SaveFileDialog
        Dim oBitmap As Bitmap
        Dim HIcon As IntPtr
        Dim newIcon As Icon
        Dim oFileStream As IO.FileStream

        oOpenFileDialog = New OpenFileDialog
        oOpenFileDialog.Filter = "Bitmap File| *.bmp"
        If oOpenFileDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
            TextBox1.Text = oOpenFileDialog.FileName

            ' Create a Bitmap object from an image file.
            oBitmap = New Bitmap(oOpenFileDialog.FileName)

            ' Get an Hicon for myBitmap.
            HIcon = oBitmap.GetHicon()

            ' Create a new icon from the handle.
            newIcon = System.Drawing.Icon.FromHandle(HIcon)

            ' Set the form Icon attribute to the new icon.
            Me.Icon = newIcon

            'Save the bitmap to new file
            oSaveFileDialog = New SaveFileDialog
            oSaveFileDialog.DefaultExt = ".ico"
            'oSaveFileDialog.AddExtension = True
            If oSaveFileDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
                oFileStream = New IO.FileStream(oSaveFileDialog.FileName, IO.FileMode.CreateNew)
                newIcon.Save(oFileStream)
                oFileStream.Close()
            End If



        End If
    End Sub
End Class




Download the sample code here : SampleBitmaptoIcon.zip


I use Microsoft Visual Studio 2010 to do all my projects. I suggest you to buy and get the best IDE in the world and the newest one: Microsoft Visual Studio 2012 on Amazon

Reference :


Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
NB :: Bila Sobat tertarik Ingin membuat software, membeli software, membeli source code, membeli hardware elektronika untuk kepentingan Perusahaan maupun Tugas Akhir (TA/SKRIPSI), Insyaallah Saya siap membantu, untuk Respon Cepat dapat menghubungi kami, melalui :

No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com


atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :

ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَٰلَمِين
Alhamdulilah hirobil alamin

وَ السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
wassalamualaikum warahmatullahi wabarakatuh


Artikel How Convert Bmp To Icon in VBNET?, Diterbitkan oleh scodeaplikasi pada Senin, 17 Juni 2013. Semoga artikel ini dapat menambah wawasan Anda. Website ini dipost dari beberapa sumber, bisa cek disini sumber, Sobat diperbolehkan mengcopy paste / menyebar luaskan artikel ini, karena segala yang dipost di public adalah milik public. Bila Sobat tertarik Ingin membuat software, membeli software, membeli source code ,Dengan Cara menghubungi saya Ke Email: Fajarudinsidik@gmail.com, atau No Hp/WA : (fajar) : 085369237896, (puat) : 085267792168.

Tawk.to