Aplikasi Notepad
Nama : Ahmad Farhan Zuhdi
NIM : 13141008
Kelas : 13.6A.37 (BSI PEMUDA)
Tugas Network Programming II
Gambar 3.1. Tampilan Display Notepad
Gambar 3.2. Tampilan Menu "File" pada Notepad
Gambar 3.3. Tampilan Menu "Edit" pada Notepad
Gambar 3.4. Tampilan Menu "Format" pada Notepad
Gambar 3.5. Tampilan Menu "Format - Font" pada Notepad
Gambar 3.6. Tampilan Menu "Format" pada Notepad (2)
Gambar 3.7. Tampilan Menu "Format - Color" pada Notepad
Gambar 3.8. Tampilan Menu "Help - About" pada Notepad
Coding Project :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace Notepad
{
public partial class Form1 : Form
{
string path;
public Form1()
{
InitializeComponent();
}
private void newToolStripMenuItem_Click(object sender, EventArgs e)
{
path = string.Empty;
richTextBox.Clear();
}
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() == DialogResult.OK) richTextBox.LoadFile(ofd.FileName, RichTextBoxStreamType.PlainText);
this.Text = ofd.FileName;
}
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "Text Document(*.txt)|*.txt|All Files(*.*)|*.*";
if (sfd.ShowDialog() == DialogResult.OK) richTextBox.SaveFile(sfd.FileName, RichTextBoxStreamType.PlainText);
this.Text = sfd.FileName;
}
private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
{
SaveFileDialog safd = new SaveFileDialog();
safd.Filter = "Text Document(*.txt)|*.txt|All Files(*.*)|*.*";
if (safd.ShowDialog() == DialogResult.OK) richTextBox.SaveFile(safd.FileName, RichTextBoxStreamType.PlainText);
this.Text = safd.FileName;
}
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
using (frmAbout frm = new frmAbout())
{
frm.ShowDialog();
}
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void cutToolStripMenuItem_Click(object sender, EventArgs e)
{
richTextBox.Cut();
}
private void copyToolStripMenuItem_Click(object sender, EventArgs e)
{
richTextBox.Copy();
}
private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
{
richTextBox.Paste();
}
private void undoToolStripMenuItem_Click(object sender, EventArgs e)
{
richTextBox.Undo();
}
private void redoToolStripMenuItem_Click(object sender, EventArgs e)
{
richTextBox.Redo();
}
private void selectAllToolStripMenuItem_Click(object sender, EventArgs e)
{
richTextBox.SelectAll();
}
private void fontToolStripMenuItem_Click(object sender, EventArgs e)
{
FontDialog fd = new FontDialog();
if (fd.ShowDialog() == DialogResult.OK) richTextBox.Font = fd.Font;
}
private void colorToolStripMenuItem_Click(object sender, EventArgs e)
{
ColorDialog cd = new ColorDialog();
if (cd.ShowDialog() == DialogResult.OK) richTextBox.ForeColor = cd.Color;
}
}
}
0 komentar:
Posting Komentar