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.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 WindowsFormsApplication2
{
public partial class Form1 : Form
{
private Stopwatch stopw = null;
public Form1()
{
InitializeComponent();
this.StartPosition=FormStartPosition.CenterScreen;
this.FormBorderStyle = FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
}
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
private Stopwatch stopw = null;
public Form1()
{
InitializeComponent();
this.StartPosition=FormStartPosition.CenterScreen;
this.FormBorderStyle = FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
}
private void Form1_Load(object sender, EventArgs e)
{
{
}
private void button1_Click(object sender, EventArgs e)
{
stopw = new Stopwatch();
stopw.Start();
button1.Enabled = false;
{
stopw = new Stopwatch();
stopw.Start();
button1.Enabled = false;
}
private void timer1_Tick(object sender, EventArgs e)
{
if (stopw != null)
{
label1.Text = stopw.Elapsed.ToString(@"hh\:mm\:ss");
}
}
{
if (stopw != null)
{
label1.Text = stopw.Elapsed.ToString(@"hh\:mm\:ss");
}
}
private void button2_Click(object sender, EventArgs e)
{
stopw.Stop();
button1.Enabled = true;
}
{
stopw.Stop();
button1.Enabled = true;
}
private void button3_Click(object sender, EventArgs e)
{
stopw.Start();
timer1.Enabled = true;
}
{
stopw.Start();
timer1.Enabled = true;
}
private void button4_Click(object sender, EventArgs e)
{
stopw.Reset();
timer1.Enabled = true;
}
{
stopw.Reset();
timer1.Enabled = true;
}
}
}
}
2. PEMBUATAN NOTEPAD
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;
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 WindowsFormsApplication6
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.StartPosition= FormStartPosition.CenterScreen;
this.FormBorderStyle = FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
}
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.StartPosition= FormStartPosition.CenterScreen;
this.FormBorderStyle = FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
}
void bersih ()
{
rtinput.Text = "";
}
void bukafile()
{
bersih();
OpenFileDialog buka = new OpenFileDialog();
buka.DefaultExt = ".txt";
buka.Filter = " Text Document | *.txt";
buka.FileName = "";
{
rtinput.Text = "";
}
void bukafile()
{
bersih();
OpenFileDialog buka = new OpenFileDialog();
buka.DefaultExt = ".txt";
buka.Filter = " Text Document | *.txt";
buka.FileName = "";
if (buka.ShowDialog() != DialogResult.Cancel)
{
string fileTerpilih = buka.FileName;
if (fileTerpilih != "")
{
rtinput.LoadFile(fileTerpilih, RichTextBoxStreamType.PlainText);
}
{
string fileTerpilih = buka.FileName;
if (fileTerpilih != "")
{
rtinput.LoadFile(fileTerpilih, RichTextBoxStreamType.PlainText);
}
}
}
void simpanfile()
{
SaveFileDialog simpan = new SaveFileDialog();
simpan.Filter = " Text Document | *.txt";
simpan.RestoreDirectory = true;
if (simpan.ShowDialog() != DialogResult.Cancel)
{
StreamWriter filesimpan = new StreamWriter(File.Create(simpan.FileName));
filesimpan.Write(rtinput.Text);
filesimpan.Dispose();
}
}
void simpanfile()
{
SaveFileDialog simpan = new SaveFileDialog();
simpan.Filter = " Text Document | *.txt";
simpan.RestoreDirectory = true;
if (simpan.ShowDialog() != DialogResult.Cancel)
{
StreamWriter filesimpan = new StreamWriter(File.Create(simpan.FileName));
filesimpan.Write(rtinput.Text);
filesimpan.Dispose();
}
}
private void bbukafile_Click(object sender, EventArgs e)
{
if (rtinput.Text != "")
{
if (rtinput.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();
}
}
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 bsimpan_Click(object sender, EventArgs e)
{
simpanfile();
{
simpanfile();
}
private void rtinput_TextChanged(object sender, EventArgs e)
{
{
}
}
}
}
}
3. IMAGE RESIZER
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.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace image
{
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;
tsize.MaxLength = 3;
tsize.Enabled = false;
}
{
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;
tsize.MaxLength = 3;
tsize.Enabled = false;
}
void ubahsize()
{
if (tsize.Text != "")
{
int persen = Convert.ToInt32(tsize.Text);
int tinggi = (persen * Convert.ToInt32(ltinggi.Text)) / 100;
int lebar = (persen * Convert.ToInt32(llebar.Text)) / 100;
ltinggi.Text = Convert.ToString(tinggi);
llebar.Text = Convert.ToString(lebar);
}
}
void simpangambar()
{
int tinggi = Convert.ToInt32(ltinggi.Text);
int lebar = Convert.ToInt32(llebar.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();
simpan.Filter = "Jpeg Format|*.Jpg";
simpan.RestoreDirectory = true;
{
if (tsize.Text != "")
{
int persen = Convert.ToInt32(tsize.Text);
int tinggi = (persen * Convert.ToInt32(ltinggi.Text)) / 100;
int lebar = (persen * Convert.ToInt32(llebar.Text)) / 100;
ltinggi.Text = Convert.ToString(tinggi);
llebar.Text = Convert.ToString(lebar);
}
}
void simpangambar()
{
int tinggi = Convert.ToInt32(ltinggi.Text);
int lebar = Convert.ToInt32(llebar.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();
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");
}
}
{
ukuranbaru.Save(simpan.FileName);
ukuranbaru.Dispose();
MessageBox.Show("Gambar Berhasil Disimpan", "Info");
}
}
void bukagambar()
{
{


