Kamis, 26 April 2018

Membuat Aplikasi Billing Sederhana Menggunakan Ms. Visual Studio 2010

Pada kali ini saya akan berbagi tentang cara pembuatan Aplikasi Billing sederhana menggunakan Ms. Visual Studio 2010.

Oke sebelum kita mulai, alangkah baiknya ikuti cara-cara yang saya berikan pada gambar berikut :
Ubah nama Text di properties seperti keterangan diatas.
Untuk petunjuk yang saya berikan itu adalah nama design di properties, jika anda mengerti bisa diganti sesuai keinginan.

Berikut Kodingannya :

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;
using System.Diagnostics;

namespace BillingSederhana
{
    public partial class Form1 : Form
    {
        private Stopwatch wkt = null;
        public Form1()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "")
            {
                wkt = new Stopwatch();
                if (button1.Text == "Log In")
                {
                    label2.Visible = true;
                    wkt.Start();
                    button1.Text = "Stop";
                }
                else if (button1.Text == "Stop")
                {
                    wkt.Stop();
                    if (wkt.Elapsed.TotalMinutes <= 30.00)
                    {
                        MessageBox.Show("Jumlah Tagihan Anda Sebesar Rp. 1000,-", "Total Tagihan");

                    }
                    else if (wkt.Elapsed.TotalHours <= 1.00)
                    {
                        MessageBox.Show("Jumlah Tagihan Anda Sebesar Rp. 2000,-", "Total Tagihan");
                    }
                    wkt.Reset();
                    label2.Visible = false;
                    button1.Text = "Log In";
                    textBox1.Text = null;
                }
                else if (textBox1.Text == "")
                {
                    MessageBox.Show("Insert Username!", "Important Message");
                }
            }
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (wkt != null)
            {
                label2.Text = wkt.Elapsed.ToString(@"hh\:mm\:ss");
            }
        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            if (textBox1.Text != "")
            {
                wkt = new Stopwatch();
                if (button1.Text == "Log In")
                {
                    label2.Visible = true;
                    wkt.Start();
                    button1.Text = "Stop";
                }
                else if (button1.Text == "Stop")
                {
                    wkt.Stop();
                    if (wkt.Elapsed.TotalMinutes <= 30.00)
                    {
                        MessageBox.Show("Jumlah Tagihan Anda Sebesar Rp. 1000,-", "Total Tagihan");

                    }
                    else if (wkt.Elapsed.TotalHours <= 1.00)
                    {
                        MessageBox.Show("Jumlah Tagihan Anda Sebesar Rp. 2000,-", "Total Tagihan");
                    }
                    wkt.Reset();
                    label2.Visible = false;
                    button1.Text = "Log In";
                    textBox1.Text = null;
                }
                else if (textBox1.Text == "")
                {
                    MessageBox.Show("Insert Username!", "Important Message");
                }
            }

        }
    }
}

Jika sudah mengkodingnya... coba jalankan aplikasi tersebut, jika sukses maka akan tampil seperti gambar berikut :

Ini tampilan ketika anda diperintahkan memasukan Username.
maka anda akan diperintahkan untuk memasukan username, username disini sifatnya bebas hanya untuk syarat login saja. jika sudah memasukan username, dan mengklik tombol login tampilannya seperti berikut :

Ketika tombol login di tekan, maka waktu akan berjalan dan tombol Login berubah menjadi tombol Stop. Jika anda sudah selesai menggunakan maka tekanlah tombol Stop dan akan tampil tagihan seperti berikut :


Oke sekian dari saya, kalau ada kekurangan atau kesalahan mohon dikoreksi lagi dikolom komentar...

Terima Kasih .

SELAMAT MENCOBA!!!

Sabtu, 21 April 2018

Membuat Image Resizer Sederhana Menggunakan Ms. Visual Studio 2010

Pada kali ini saya ingin berbagi tentang cara pembuatan Image Resizer sederhana menggunakan Ms. Visual Studio 2010 ...

Oke sebelum kita mulai, alangkah baiknya ikuti cara-cara yang saya berikan pada gambar berikut :
Contoh gambar ketika program berjalan.
Ubah nama-nama seperti diatas melalui fitur properties di Ms. Visual Studio 2010 , agar programnya berjalan alias tidak error.

Form1 = Image Resizer = Form1
Button = Buka Gambar = bt_buka
Button = Simpan Gambar = button2
Label = Tinggi Gambar = Label1
Label = Lebar Gambar = Label2
Label = OUT = lb_tg_gmbr
Label = OUT = lb_lbr_gmbr
Label = Resize Gambar = Label5
Label = % = Label6
PictureBox = - = bt_simpan
TextBox1 = - = t_resize


NB : Tanda strip di atas berarti dikosongkan saja.

Berikut Kodingannya :

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 Pertemuan4
{
    public partial class Form1 : Form
    {
        private Image gambar;
        public Form1()
        {
            InitializeComponent();
            this.StartPosition = FormStartPosition.CenterScreen;
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            t_resize.MaxLength = 3;
            t_resize.Enabled = false;
        }

        private void bt_buka_Click(object sender, EventArgs e)
        {
            OpenFileDialog bukaGambar = new OpenFileDialog();
            if (bukaGambar.ShowDialog() == DialogResult.OK)
            {
                this.gambar = Image.FromFile(bukaGambar.FileName);
                bt_simpan.SizeMode =
                PictureBoxSizeMode.StretchImage;
                //menyesuaikan gambar sesuai dengan picturebox 

                bt_simpan.ImageLocation = bukaGambar.FileName;
                //mencari lokasi gambar
                lb_tg_gmbr.Text = gambar.Height.ToString();
                lb_lbr_gmbr.Text = gambar.Width.ToString();
                t_resize.Enabled = true;
                t_resize.Clear();
            }



        }

        private void label5_Click(object sender, EventArgs e)
        {


        }
        
        private void button2_Click(object sender, EventArgs e)
        {
            int tinggi = Convert.ToInt32(lb_tg_gmbr.Text);
            int lebar = Convert.ToInt32(lb_lbr_gmbr.Text);
            Bitmap ukuranBaru = new Bitmap(lebar,
            tinggi, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            Graphics Gbr = Graphics.FromImage(ukuranBaru);

            Gbr.CompositingQuality =
            System.Drawing.Drawing2D.CompositingQuality.HighSpeed;
            Gbr.SmoothingMode =
            System.Drawing.Drawing2D.SmoothingMode.HighSpeed;
            Gbr.InterpolationMode =
          System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
            Gbr.PixelOffsetMode =
            System.Drawing.Drawing2D.PixelOffsetMode.HighSpeed;

            Rectangle rect = new Rectangle(0, 0, lebar, tinggi);
            Gbr.DrawImage(gambar, rect);

            SaveFileDialog simpan = new SaveFileDialog();
            //listing program untuk penyimpanan 
            simpan.Filter = "Jpeg Format|*.Jpg";
            simpan.RestoreDirectory = true;
            if (simpan.ShowDialog() != DialogResult.Cancel)
            {
                ukuranBaru.Save(simpan.FileName);
                ukuranBaru.Dispose();
                MessageBox.Show("Gambar Berhasil Disimpan", "Info");
            }
        }

        private void resize_key(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (t_resize.Text != "")
                {
                    int persen = Convert.ToInt32(t_resize.Text);
                    int tinggi = (persen *
                    Convert.ToInt32(lb_tg_gmbr.Text)) / 100;
                    int lebar = (persen *
                    Convert.ToInt32(lb_lbr_gmbr.Text)) / 100;
                    lb_tg_gmbr.Text = Convert.ToString(tinggi);
                    lb_lbr_gmbr.Text = Convert.ToString(lebar);

                }


            }
        }
    }

}

Oke itu saja dari saya, kurang lebihnya mohon dimaafkan ...
Terima Kasih .
Sampai jumpa ditutorial selanjutnya...

SELAMAT MENCOBA!!!😎😎😎

Membuat Notepad Sederhana Menggunakan Ms. Visual Studio 2010

Pada kali ini saya ingin berbagi tentang cara pembuatan Simple Notepad sederhana menggunakan Ms. Visual Studio 2010 ...
Oke sebelum kita mulai, alangkah baiknya ikuti cara-cara yang saya berikan pada gambar berikut :
Contoh gambar ketika program berjalan.
Ubah nama-nama seperti diatas melalui fitur properties di Ms. Visual Studio 2010 , agar programnya berjalan alias tidak error.
Berikut Kodingannya :

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;
using Microsoft.Win32;
using System.IO;

namespace notepad
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.StartPosition = FormStartPosition.CenterScreen;



            this.MaximizeBox = false;

            this.MinimizeBox = false;
        }

        void bersih()
        {
            richTextBox1.Text = "";
        }

        void bukafile()
        {
            bersih();
            OpenFileDialog buka = new OpenFileDialog();
            buka.DefaultExt = ".txt";
            buka.Filter = "Text Documents | *.txt";
            buka.FileName = "";

            if (buka.ShowDialog() != DialogResult.Cancel)
            {
                string fileTerpilih = buka.FileName;
                if (fileTerpilih != "")
                {
                    richTextBox1.LoadFile(fileTerpilih, RichTextBoxStreamType.PlainText);
                }
            }
        }


        void simpanfile()
        {
            SaveFileDialog simpan = new SaveFileDialog();
            simpan.Filter = "Text Documents | *.txt";
            simpan.RestoreDirectory = true;
            if (simpan.ShowDialog() != DialogResult.Cancel)
            {
                StreamWriter filesimpan = new StreamWriter(File.Create(simpan.FileName));
                filesimpan.Write(richTextBox1.Text);
                filesimpan.Dispose();
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (richTextBox1.Text != "")
            {
                var pesan = MessageBox.Show("File belum tersimpan, yakin ingin membuka file baru??", "konfirmasi", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (pesan == DialogResult.Yes)
                {
                    bukafile();
                }
            }

            else
            {
                bukafile();
            }
        }

        private void button2_Click_1(object sender, EventArgs e)
        {
            simpanfile();

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            bersih();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            richTextBox1.SelectionFont = new Font(richTextBox1.Font, FontStyle.Bold);
            richTextBox1.SelectionStart = richTextBox1.SelectionStart + richTextBox1.SelectionLength;
            richTextBox1.SelectionLength = 0;
            richTextBox1.SelectionFont = richTextBox1.Font;
        }

        private void button4_Click(object sender, EventArgs e)
        {
            richTextBox1.SelectionFont = new Font(richTextBox1.Font, FontStyle.Italic);
            richTextBox1.SelectionStart = richTextBox1.SelectionStart + richTextBox1.SelectionLength;
            richTextBox1.SelectionLength = 0;
            richTextBox1.SelectionFont = richTextBox1.Font;
        }

        private void button3_Click_1(object sender, EventArgs e)
        {
            richTextBox1.SelectionFont = new Font(richTextBox1.Font, FontStyle.Bold);
            richTextBox1.SelectionStart = richTextBox1.SelectionStart + richTextBox1.SelectionLength;
            richTextBox1.SelectionLength = 0;
            richTextBox1.SelectionFont = richTextBox1.Font;
        }
    }
}


Oke itu saja dari saya, kurang lebihnya mohon dimaafkan ...
Terima Kasih .

SELAMAT MENCOBA!!!😎😎😎

Membuat Stopwatch Sederhana Menggunakan Ms. Visual Studio 2010

Pada kali ini saya ingin berbagi tentang cara pembuatan stopwatch sederhana menggunakan Ms. Visual Studio 2010 ...
Oke sebelum kita mulai, alangkah baiknya ikuti cara-cara yang saya berikan pada gambar berikut :
Contoh gambar ketika program berjalan dan Component.
Ubah nama-nama seperti diatas melalui properties, agar programnya berjalan alias tidak error.
Berikut Kodingannya :

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;

// Script tambahan
using System.Diagnostics;

namespace stopwatch
{
    public partial class StopWatch : Form
    {
        //tambahan script
        private Stopwatch stopw = null;

        public StopWatch()
        {
            InitializeComponent();
        }

        private void timer1_Tick_1(object sender, EventArgs e)
        {
            if (stopw != null)
            {
                label2.Text = stopw.Elapsed.ToString(@"hh\:mm\:ss\:ff");
            }
        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            stopw = new Stopwatch();
            stopw.Start();
            button1.Enabled = true;
        }

        private void button2_Click_1(object sender, EventArgs e)
        {
            stopw.Stop();
            button2.Enabled = true;
        }

        private void button3_Click_1(object sender, EventArgs e)
        {
            stopw.Reset();
            button3.Enabled = true;

        }

    }

}

Oke itu saja dari saya, kurang lebihnya mohon dimaafkan ...
Terima Kasih .

SELAMAT MENCOBA!!!😎😎😎