Selasa, 26 Mei 2015

Membuat Aplikasi Menu Menggunakan Pemrograman Visual C#

Contoh Kode Program Menu Musik

Public artinya method tersebut memiliki akses modifier
Void artinya tidak membalikan nilai
 Private artinya method tersebut memiliki akses untuk ditampilkan pribadi

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace menuMusik
{

    public partial class Aplikasi : Form
    {
        public Aplikasi()
        {
            InitializeComponent();
        }

        private void groupBox1_Enter(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            listBoxLagu.Items.Add("Anda Memilih Nama Band : " + comboBoxBand.Text);
            listBoxLagu.Items.Add("Anda Memilih Genre     : " + comboBoxGenre.Text);
            listBoxLagu.Items.Add("Anda Memilih Lagu      : " + comboBoxLagu.Text);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            if (radioButton1.Checked == true)
            {
                MessageBox.Show("Anda Memilih Lagu Jalani Bersama");
            }
            if (radioButton2.Checked == true)
            {
                MessageBox.Show("Anda Memilih Lagu I Love You");
            }
            if (radioButton3.Checked == true)
            {
                MessageBox.Show("Anda Memilih Lagu Bintang Kecil");
            }
            if (radioButton4.Checked == true)
            {
                MessageBox.Show("Anda Memilih Lagu Tidak Diketahui");
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            MessageBox.Show(textBox1.Text);
        }

        private void button4_Click(object sender, EventArgs e)
       {
            string Pesan = "";
       
            if (checkBox1.Checked == true)
            {
                Pesan = "Jalani Bersama";
            }
            if (checkBox2.Checked == true)
            {
                Pesan = Pesan + "I Love You";
            }
            if (checkBox3.Checked == true)   
            {
                Pesan = Pesan + "Bintang Kecil";
            }
           
           
            if ( Pesan.Length > 0)
            {
                MessageBox.Show ("panjang pesan " + Pesan.Length + " : " +Pesan);
            }
            else
            {
                MessageBox.Show("Tidak ada yang dipilih");
            }
       }

        private void button5_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "images files|*.png;*.jpg;*.jpeg;*.bmp;*.tif";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                pictureBox1.Image = new Bitmap(openFileDialog1.FileName);
            }
        }

        private void button7_Click(object sender, EventArgs e)
        {
            MessageBox.Show(dateTimePicker1.Text);
        }
    }

    }

 MessageBox.Show untuk menampilkan pesan
Open file dialog untuk membuka file

 Contoh tampilan gambar

Tidak ada komentar:

Posting Komentar