Friday, October 11, 2013

cara buat game TETRIS in C#

  

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 Tetris
{
    public partial class Form1 : Form
    {
        public lurus2 tetris;
        public Form1()
        {
            InitializeComponent();
        }


        private void btnRandom_Click(object sender, EventArgs e)
        {
            lurus2 tetris = new lurus2();
            tetris.buat(gbLayar);
        }

        class lurus2
        {
            int xawal = 100;
            int yawal = 50;

            Button kotak = new Button();
            Button kotak2 = new Button();
            Button kotak3 = new Button();

            public void buat(GroupBox layar)
            {
                kotak.Size = new Size(20, 20);
                kotak.Left = kotak.Left + xawal;
                kotak.Top = kotak.Top + yawal;
                layar.Controls.Add(kotak);

                kotak2.Size = new Size(20, 20);
                kotak2.Left = kotak.Left + 20;
                kotak2.Top = kotak.Top;
                layar.Controls.Add(kotak2);

                kotak3.Size = new Size(20, 20);
                kotak3.Left = kotak2.Left + 20;
                kotak3.Top = kotak2.Top;
                layar.Controls.Add(kotak3);
            }



            public void geser_kiri()
            {
                kotak.Left = kotak.Left + 20;
                kotak2.Left = kotak2.Left + 20;

            }




            /*void lurus()
            {
                Button kotak = new Button();
                Button kotak2 = new Button();
                Button kotak3 = new Button();
                kotak.Size = new Size(20, 20);

                gbLayar.Controls.Add(kotak);
                kotak.Left = 100;
                kotak.Top = 150;
                kotak2.Left = kotak.Left + 20;
                kotak2.Size = new Size(20, 20);
                kotak2.Top = kotak.Top;
                gbLayar.Controls.Add(kotak2);
                kotak3.Left = kotak2.Left + 20;
                kotak3.Top = kotak.Top;
                kotak3.Size = new Size(20, 20);
                gbLayar.Controls.Add(kotak3);
            }*/

            private void btnKiri_Click(object sender, EventArgs e)
            {

            }

        }

        private void btnKiri_Click(object sender, EventArgs e)
        {
            tetris.geser_kiri();
        }
    }
}

Pemrograman WEB


PEMROGRAMAN BERORIENTASI OBJEK_ C#



//Program menghitung hambatan
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 MenghitungHambatan
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            float r1 = Convert.ToSingle(txtR1.Text);
            float r2 = Convert.ToSingle(txtR2.Text);
            float r3 = Convert.ToSingle(txtR3.Text);
            float r4 = Convert.ToSingle(txtR4.Text);

            if (optSeri.Checked) {
            txtHasil.Text= Convert.ToString(seri(r1,r2,r3,r4));
            }
            if (optParalel.Checked) {
                txtHasil.Text = Convert.ToString(paralel(r1,r2,r3,r4));
            }
        }
        //bebas membuat fungsi
        float seri(float r1, float r2, float r3, float r4) {
            return r1 + r2 + r3 + r4;
        }
        float paralel(float r1, float r2, float r3, float r4) {
            return (1 / r1) + (1 / r2) + (1 / r3) + (1 / r4);
        }

        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {

        }
    }
}


perancangan basis data 3


Perancangan Basis data - 2


perancangan basis data