B.
Interface Program
C.
Coding Program
1.
Form1
Variabel
Komponen
|
Source Code
|
cbTujuan
|
private void comboBox1_SelectedIndexChanged(object
sender, EventArgs e)
{
if (comboBox1.SelectedIndex
== 0)
txtHargaTiket.Text
= "180000";
else
if (comboBox1.SelectedIndex
== 1)
txtHargaTiket.Text
= "200000";
else
if (comboBox1.SelectedIndex
== 2)
txtHargaTiket.Text = "300000";
else
if (comboBox1.SelectedIndex
== 3)
txtHargaTiket.Text
= "100000";
}
|
btnProses
|
private void btnProses_Click(object sender, EventArgs
e)
{
Form2 Jendela2 =
new Form2(txtNoTransaksi.Text, txtNama.Text, txtAlamat.Text, comboBox1.Text,
txtHargaTiket.Text);
Jendela2.Show();
this.Hide();
}
|
2.
Form2
Variabel
Komponen
|
Source Code
|
Form2
|
public Form2 (string NoTransaksi, string Nama, string
Alamat, string Tujuan, string HargaTiket):this()
{
lbNoTransaksi.Text =
NoTransaksi;
lbNama.Text = Nama;
lbAlamat.Text = Alamat;
lbTujuan.Text = Tujuan;
lbHargaTiket.Text =
HargaTiket;
}
|
printDocument1
|
private void printDocument1_PrintPage(object
sender, System.Drawing.Printing.PrintPageEventArgs e)
{
var font =
new Font("Arial", 12);
e.Graphics.DrawString("Transaksi
Pembelian Tiket Bis \n", font, Brushes.Black, 50, 10);
e.Graphics.DrawString("\n"
+ "No Transaksi" + "\t" + ": " + lbNoTransaksi.Text
+ "\n", font, Brushes.Black, 25, 30);
e.Graphics.DrawString("\n"
+ "Nama" + "\t" + "\t" + ": " +
lbNama.Text + "\n", font, Brushes.Black, 25, 50);
e.Graphics.DrawString("\n"
+ "Alamat" + "\t" + "\t" + ": " +
lbAlamat.Text + "\n", font, Brushes.Black, 25, 70);
e.Graphics.DrawString("\n"
+ "Tujuan" + "\t" + "\t" + ": " +
lbTujuan.Text + "\n", font, Brushes.Black, 25, 90);
e.Graphics.DrawString("\n"
+ "Harga Tiket" + "\t" + ": " + lbHargaTiket.Text
+ "\n", font, Brushes.Black, 25, 110);
}
|
btnPrintPreview
|
private void button1_Click(object sender, EventArgs
e)
{
printPreviewDialog1.Document = printDocument1;
printPreviewDialog1.PrintPreviewControl.Zoom
= 1;
printPreviewDialog1.ShowDialog();
}
|
btnKembali
|
private void btnKembali_Click(object sender, EventArgs
e)
{
Form1
jendela1 = new Form1();
jendela1.Show();
this.Hide();
}
|
suwun ya gan,,, tak comot,,,, bagi pin dong buat diskusi
BalasHapus