Friday, January 17, 2014

Pengolahan Citra


Program ini saya tujukan untuk memenuhi tugas saya kepada Dosen Pembimbing saya.Tugas Belajar Bahasa Pemograman.

Kali ini saya mau memposting tugas kuliah saya tentang pengolahan citra.

# Listing Program Pengolahan Citra

Public Class Form2
    Dim gambar2 As Bitmap

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles MyBase.Load
        PictureBox2.Image = PictureBox1.Image
    End Sub

Button 1 : Button - Hijau
    Private Sub button1_Click(ByVal sender As System.Object, ByVal eAs System.EventArgs) Handles button1.Click
        Dim Pb, Pc As Integer
        Dim Vm, Vh, Vb As Double
        gambar2 = New Bitmap(PictureBox2.Image)
        For Pb = 0 To gambar2.Height - 1
            For Pc = 0 To gambar2.Width - 1
                Vm = gambar2.GetPixel(Pc, Pb).R - 10
                Vh = gambar2.GetPixel(Pc, Pb).G
                Vb = gambar2.GetPixel(Pc, Pb).B
                If Vm <= 0 Then Vm = 0
                gambar2.SetPixel(Pc, Pb, Color.FromArgb(Vm, Vh, Vb))
            Next
            PictureBox2.Image = gambar2
            PictureBox2.Refresh()
        Next
    End Sub

Button 2 : Button + Hijau

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal eAs System.EventArgs) Handles Button2.Click
        Dim Pb, Pc As Integer
        Dim Vm, Vh, Vb As Double
        gambar2 = New Bitmap(PictureBox2.Image)
        For Pb = 0 To gambar2.Height - 1
            For Pc = 0 To gambar2.Width - 1
                Vm = gambar2.GetPixel(Pc, Pb).R + 10
                Vh = gambar2.GetPixel(Pc, Pb).G
                Vb = gambar2.GetPixel(Pc, Pb).B
                If Vm >= 255 Then Vm = 255
                gambar2.SetPixel(Pc, Pb, Color.FromArgb(Vm, Vh, Vb))
            Next
            PictureBox2.Image = gambar2
            PictureBox2.Refresh()
        Next
    End Sub

Button 3 : Button Greyscale
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal eAs System.EventArgs) Handles Button3.Click
        Dim Pb, Pc As Integer
        Dim Rt, Vm, Vh, Vb As Double
        gambar2 = New Bitmap(PictureBox2.Image)
        For Pb = 0 To gambar2.Height - 1
            For Pc = 0 To gambar2.Width - 1
                Vm = gambar2.GetPixel(Pc, Pb).R
                Vh = gambar2.GetPixel(Pc, Pb).G
                Vb = gambar2.GetPixel(Pc, Pb).B
                Rt = (Vm + Vh + Vb) / 3
                gambar2.SetPixel(Pc, Pb, Color.FromArgb(Rt, Rt, Rt))
            Next
            PictureBox2.Image = gambar2
            PictureBox2.Refresh()
        Next
    End Sub

Button 4 : - Merah
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal eAs System.EventArgs) Handles Button4.Click
        Dim Pb, Pc As Integer
        Dim Vm, Vh, Vb As Double
        gambar2 = New Bitmap(PictureBox2.Image)
        For Pb = 0 To gambar2.Height - 1
            For Pc = 0 To gambar2.Width - 1
                Vm = gambar2.GetPixel(Pc, Pb).R + 5
                Vh = gambar2.GetPixel(Pc, Pb).G + 5
                Vb = gambar2.GetPixel(Pc, Pb).B + 5
                If Vm >= 255 Then Vm = 255
                If Vb >= 255 Then Vb = 255
                If Vh >= 255 Then Vh = 255
                gambar2.SetPixel(Pc, Pb, Color.FromArgb(Vm, Vh, Vb))
            Next
            PictureBox2.Image = gambar2
            PictureBox2.Refresh()
        Next
    End Sub

Button 5 : + Merah
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal eAs System.EventArgs) Handles Button5.Click
        Dim Pb, Pc As Integer
        Dim Vm, Vh, Vb As Double
        gambar2 = New Bitmap(PictureBox2.Image)
        For Pb = 0 To gambar2.Height - 1
            For Pc = 0 To gambar2.Width - 1
                Vm = gambar2.GetPixel(Pc, Pb).R - 5
                Vh = gambar2.GetPixel(Pc, Pb).G - 5
                Vb = gambar2.GetPixel(Pc, Pb).B - 5
                If Vm <= 0 Then Vm = 0
                If Vb <= 0 Then Vb = 0
                If Vh <= 0 Then Vh = 0
                gambar2.SetPixel(Pc, Pb, Color.FromArgb(Vm, Vh, Vb))
            Next
            PictureBox2.Image = gambar2
            PictureBox2.Refresh()
        Next
    End Sub

Button 6 : Button Rotate
    Private Sub Button6_Click(ByVal sender As System.Object, ByVal eAs System.EventArgs) Handles Button6.Click
        Dim Pb, Pc As Integer
        Dim Vm, Vh, Vb As Double
        gambar2 = New Bitmap(PictureBox2.Image)
        Dim Gambar3 As Bitmap = New Bitmap(PictureBox1.Image)
        For Pb = gambar2.Height - 1 To 0 Step -1
            For Pc = gambar2.Width - 1 To 0 Step -1
                Vm = gambar2.GetPixel(Pc, Pb).R
                Vh = gambar2.GetPixel(Pc, Pb).G
                Vb = gambar2.GetPixel(Pc, Pb).B
                Gambar3.SetPixel(gambar2.Width - 1 - Pc, gambar2.Height - 1 - Pb, Color.FromArgb(Vm, Vh, Vb))
            Next
            PictureBox2.Image = Gambar3
            PictureBox2.Refresh()
        Next
    End Sub

Button 7 : - Britness
    Private Sub Button7_Click(ByVal sender As System.Object, ByVal eAs System.EventArgs) Handles Button7.Click
        Dim Pb, Pc As Integer
        Dim Vm, Vh, Vb As Double
        gambar2 = New Bitmap(PictureBox2.Image)
        For Pb = 0 To gambar2.Height - 1
            For Pc = 0 To gambar2.Width - 1
                Vm = gambar2.GetPixel(Pc, Pb).R
                Vh = gambar2.GetPixel(Pc, Pb).G - 10
                Vb = gambar2.GetPixel(Pc, Pb).B
                If Vh <= 0 Then Vh = 0
                gambar2.SetPixel(Pc, Pb, Color.FromArgb(Vm, Vh, Vb))
            Next
            PictureBox2.Image = gambar2
            PictureBox2.Refresh()
        Next
    End Sub

Button 8 : + Britness
    Private Sub Button8_Click(ByVal sender As System.Object, ByVal eAs System.EventArgs) Handles Button8.Click
        Dim Pb, Pc As Integer
        Dim Vm, Vh, Vb As Double
        gambar2 = New Bitmap(PictureBox2.Image)
        For Pb = 0 To gambar2.Height - 1
            For Pc = 0 To gambar2.Width - 1
                Vm = gambar2.GetPixel(Pc, Pb).R
                Vh = gambar2.GetPixel(Pc, Pb).G + 10
                Vb = gambar2.GetPixel(Pc, Pb).B
                If Vh >= 255 Then Vh = 255
                gambar2.SetPixel(Pc, Pb, Color.FromArgb(Vm, Vh, Vb))
            Next
            PictureBox2.Image = gambar2
            PictureBox2.Refresh()
        Next
    End Sub

Button 9 : Button Negativ
    Private Sub Button9_Click(ByVal sender As System.Object, ByVal eAs System.EventArgs) Handles Button9.Click
        Dim Pb, Pc As Integer
        Dim Vm, Vh, Vb As Double
        gambar2 = New Bitmap(PictureBox2.Image)
        For Pb = 0 To gambar2.Height - 1
            For Pc = 0 To gambar2.Width - 1
                Vm = 255 - gambar2.GetPixel(Pc, Pb).R
                Vh = 255 - gambar2.GetPixel(Pc, Pb).G
                Vb = 255 - gambar2.GetPixel(Pc, Pb).B
                If Vm <= 0 Then Vm = 0
                If Vb <= 0 Then Vb = 0
                If Vh <= 0 Then Vh = 0
                gambar2.SetPixel(Pc, Pb, Color.FromArgb(Vm, Vh, Vb))
            Next
            PictureBox2.Image = gambar2
            PictureBox2.Refresh()
        Next
    End Sub

Button 10 : Button Finish
    Private Sub Button10_Click(ByVal sender As System.Object, ByVal eAs System.EventArgs) Handles Button10.Click
        End
    End Sub
End Class

Dan hasil nya ada dibawah ini :







Hasil button - Hijau


Hasil Button + Hijau


Hasil Button grayscale


Hasil Button - Merah


Hasil Button + Merah


Hasil Button Rotate


Hasil Button + Brigness


Hasil Button -Brigness


Hasil Button Negatf

Terima Kasih dan Selamat mencoba ...^^





Wednesday, January 8, 2014

Bahasa Pemograman



Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Nik.Items.Add("PM010")
        Nik.Items.Add("PS111")
        Nik.Items.Add("KU101")
        Nik.Items.Add("GD100")

        Jabatan.Items.Add("KEPALA DIVISI")
        Jabatan.Items.Add("STAFF")
        Jabatan.Items.Add("WAKIL KEPALA")

        Status.Items.Add("Menikah")
        Status.Items.Add("Tidak Menikah")

        Jumlah_ank.Items.Add("0")
        Jumlah_ank.Items.Add("2")
        Jumlah_ank.Items.Add("1")

    End Sub

    Private Sub Nik_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Nik.SelectedIndexChanged
        Select Case Nik.Text
            Case "PM010"
                Nama.Text = "Meitri Widya Pradipta"
            Case "KU101"
                Nama.Text = "Kristina Nancu L.Gaol"
            Case "PS111"
                Nama.Text = "Steven Leo T.Ginting"
            Case Else
                Nama.Text = " Doni Armando"
        End Select
        Dim K As String
        K = Microsoft.VisualBasic.Left(Nik.Text, 2)
        If K = "PM" Then
            Bagian.Text = "Pemasaran"
        ElseIf K = ("PS") Then
            Bagian.Text = "Personalia"
        ElseIf K = "KU" Then
            Bagian.Text = "Keuangan"
        Else
            Bagian.Text = "Gudang"
        End If
    End Sub

    Private Sub Jabatan_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Jabatan.SelectedIndexChanged
        Select Case Jabatan.Text
            Case "Kepala Devisit"
                Gaji_pokok.Text = "5000000"
            Case "Staf"
                Gaji_pokok.Text = "2000000"
            Case Else
                Gaji_pokok.Text = "3500000"

        End Select
        Pajak.Text = Gaji_pokok.Text * 0.1
    End Sub

    Private Sub Jumlah_ank_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Jumlah_ank.KeyPress
        If e.KeyChar = Chr(13) Then

            Select Case Jumlah_ank.Text
                Case "0"
                    tnjgan_ank.Text = 0
                Case "1"
                    tnjgan_ank.Text = Gaji_pokok.Text * 0.05
                Case "2"
                    tnjgan_ank.Text = Gaji_pokok.Text * 0.1
                Case Else
                    tnjgan_ank.Text = Gaji_pokok.Text * 0.5
            End Select
        End If
        Total_gji.Text = (Gaji_pokok.Text) + Val(Tunjangan_kluarga.Text) + Val(Tunjangan_kluarga.Text) - Pajak.Text



    End Sub

    Private Sub Jumlah_ank_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Jumlah_ank.SelectedIndexChanged

    End Sub

    Private Sub BtnKeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnKeluar.Click
        Dim tanya As String
        tanya = MsgBox("Apakah Anda ingin Keluar?", MsgBoxStyle.YesNo)
        If tanya = vbCancel Then
            Me.Close()
        ElseIf tanya = vbNo Then
            Me.Focus()
        ElseIf tanya = vbYes Then
            Me.Close()
        End If

    End Sub

    Private Sub BtnHapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnHapus.Click
        Nik.Text = ""
        Nama.Text = ""
        Bagian.Text = ""
        Jabatan.Text = ""
        tnjgan_ank.Text = ""
        Tunjangan_kluarga.Text = ""
        Pajak.Text = ""
        Status.Text = ""
        Gaji_pokok.Text = ""
        Total_gji.Text = ""
        Jumlah_ank.Text = ""


    End Sub

    Private Sub Status_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Status.SelectedIndexChanged
        Select Case Status.Text
            Case "Menikah"
                Tunjangan_kluarga.Text = Gaji_pokok.Text * 0.15
            Case "Tidak Menikah"

                Jumlah_ank.Text = ""
                Tunjangan_kluarga.Text = 0
        End Select

    End Sub

    Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click

    End Sub
End Class



Sunday, December 8, 2013

Quis no 1



Public Class Quiz1

    Sub BuatTabel()
        Storage.Columns.Add("No Pembelian", 80, HorizontalAlignment.Center)
        Storage.Columns.Add("Kode Barang", 80, HorizontalAlignment.Center)
        Storage.Columns.Add("Nama Barang", 80, HorizontalAlignment.Center)
        Storage.Columns.Add("Harga", 80, HorizontalAlignment.Center)
        Storage.Columns.Add("Merk", 80, HorizontalAlignment.Center)
        Storage.Columns.Add("Jumlah Pembelian", 80, HorizontalAlignment.Center)
        Storage.Columns.Add("Total Harga", 80, HorizontalAlignment.Center)
        Storage.View = View.Details
        Storage.GridLines = True
        Storage.FullRowSelect = True
    End Sub

    Sub IsiTabel()
        Dim Lst As New ListViewItem
        Lst.Text = No_Pembelian.Text
        Lst.SubItems.Add(Kd_Barang.Text)
        Lst.SubItems.Add(Nm_Barang.Text)
        Lst.SubItems.Add(Harga.Text)
        Lst.SubItems.Add(Merk.Text)
        Lst.SubItems.Add(Jumlah.Text)
        Lst.SubItems.Add(Total.Text)
        Storage.Items.Add(Lst)
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Kd_Barang.Items.Add("TS001")
        Kd_Barang.Items.Add("TS002")
        Kd_Barang.Items.Add("VG001")
        Kd_Barang.Items.Add("VG002")

        Call BuatTabel()

    End Sub

    Private Sub Kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Kd_Barang.SelectedIndexChanged
        Dim x As String
        x = Microsoft.VisualBasic.Left(Kd_Barang.Text, 2)
        If x = "TS" Then
            Merk.Text = "Toshiba"
        ElseIf x = "VG" Then
            Merk.Text = "V-Gen"
        End If

        x = Microsoft.VisualBasic.Right(Kd_Barang.Text, 3)
        If x = "001" Then
            Nm_Barang.Text = "Flashdisk 4GB"
        ElseIf x = "002" Then
            Nm_Barang.Text = "Flashdisk 2GB"
        End If

        Select Case Kd_Barang.Text
            Case "TS001"
                Harga.Text = "105000"
            Case "TS002"
                Harga.Text = "75000"
            Case "VG001"
                Harga.Text = "90000"
            Case "VG002"
                Harga.Text = "60000"
        End Select
    End Sub

    Private Sub Btn_Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Tambah.Click
        IsiTabel()
        No_Pembelian.Text = ""
        Kd_Barang.Text = ""
        Nm_Barang.Text = ""
        Harga.Text = ""
        Merk.Text = ""
        Jumlah.Text = ""
        Total.Text = ""
    End Sub

    Private Sub Total_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Total.KeyPress
        Total.Text = Harga.Text * Val(Jumlah.Text)
    End Sub

    Private Sub Btn_Hapus_yg_Dipilih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Hapus_yg_Dipilih.Click
        Storage.Items.Remove(Storage.SelectedItems(0))
    End Sub

    Private Sub Btn_Hapus_Semua_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Hapus_Semua.Click
        Storage.Items.Clear()
    End Sub

    Private Sub Btn_Keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Keluar.Click
        End
    End Sub

    Private Sub Btn_Bersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Bersih.Click
        No_Pembelian.Text = ""
        Kd_Barang.Text = ""
        Nm_Barang.Text = ""
        Harga.Text = ""
        Merk.Text = ""
        Jumlah.Text = ""
        Total.Text = ""
    End Sub
End Class


Postingan Nilai Mahasiswa

Ini postingan saya untuk memenuhi tugas saya mata kuliah Pemograman visual


baik inilah program nya

Public Class Form1

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        End
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        NPM.Items.Add("12110377")
        NPM.Items.Add("12110404")
        NPM.Items.Add("12110400")
        NPM.Items.Add("12110597")
        NPM.Items.Add("12110321")

        KD.Items.Add("301")
        KD.Items.Add("302")
        KD.Items.Add("303")
        KD.Items.Add("304")
        KD.Items.Add("305")

        KMK.Items.Add("301")
        KMK.Items.Add("302")
        KMK.Items.Add("303")
        KMK.Items.Add("304")
        KMK.Items.Add("305")

        Dim x As Integer
        For x = 100 To 1 Step -3
            NK.Items.Add(x)
        Next (x)
        x = 100

        Do While x >= 1
            NT.Items.Add(x)
            x = x - 3
        Loop
        For x = 100 To 1 Step -3
            UTS.Items.Add(x)
        Next (x)

        For x = 100 To 1 Step -3
            UAS.Items.Add(x)
        Next (x)

    End Sub

    Private Sub NPM_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NPM.SelectedIndexChanged
        Select Case NPM.Text
            Case "12110377"
                NM.Text = "Meitri Widya Pradipta"
                Jenjang.Text = "S1"
                Jurusan.Text = "Teknik Informatika"
            Case "12110404"
                NM.Text = "Kristina Nancy LumbanGaol"
                Jenjang.Text = "S1"
                Jurusan.Text = "Teknik Informatika"
            Case "12110400"
                NM.Text = "Steven Leo Talenta Ginting"
                Jenjang.Text = "S1"
                Jurusan.Text = "Teknik Informatika"
            Case "12110597"
                NM.Text = "Doni Armando"
                Jenjang.Text = "S1"
                Jurusan.Text = "Teknik Informatika"
            Case "12110321"
                NM.Text = "Cahyo Shobirin"
                Jenjang.Text = "S1"
                Jurusan.Text = "Teknik Informatika"
        End Select

    End Sub

    Private Sub KD_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KD.SelectedIndexChanged
        Select Case KD.Text
            Case "301"
                ND.Text = "Toni Limbong,S.Kom,M.Kom"
            Case "302"
                ND.Text = "Sinar Sinurat,ST,M.Kom"
            Case "303"
                ND.Text = "Mesran,S.Kom,M.Kom"
            Case "304"
                ND.Text = "Kennedi Tampubolon,S.Si"
            Case "305"
                ND.Text = "Kristian Siregar,S.Kom"
        End Select
    End Sub

    Private Sub KMK_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KMK.SelectedIndexChanged
        Select Case KMK.Text
            Case "301"
                MK.Text = "Sistem Basis Data"
            Case "302"
                MK.Text = "Matematika Diskrit"
            Case "303"
                MK.Text = "Pemrogaman Visual Basic"
            Case "304"
                MK.Text = "Kalkulus II"
            Case "305"
                MK.Text = "HTML"

        End Select

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        NA.Text = 0.45 * UAS.Text + 0.3 * UTS.Text + 0.15 * NT.Text + 0.1 * NK.Text()

        If NA.Text >= 50 Then
            KET.Text = "Lulus"
        Else
            KET.Text = "Gagal"
        End If

        If NA.Text >= 80 Then
            NH.Text = "A"
        ElseIf (NA.Text >= 70) And (NA.Text < 80) Then
            NH.Text = "B"
        ElseIf (NA.Text >= 60) And (NA.Text < 70) Then
            NH.Text = "C"
        ElseIf (NA.Text >= 50) And (NA.Text < 60) Then
            NH.Text = "D"
        Else
            NH.Text = "E"
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        NPM.Text = ("")
        NM.Text = ("")
        Jenjang.Text = ("")
        Jurusan.Text = ("")
        KD.Text = ("")
        ND.Text = ("")
        KMK.Text = ("")
        MK.Text = ("")
        NK.Text = ("")
        NT.Text = ("")
        UTS.Text = ("")
        UAS.Text = ("")
        NA.Text = ("")
        NH.Text = ("")
        KET.Text = ("")
    End Sub
End Class

Dan hasilnya. .