0% found this document useful (0 votes)
40 views

Notepad C# Prog Windows

The document describes a lab report on creating a notepad application in C#. The purpose of the lab was to study methods and principles for creating a notepad. The task was to create a notepad that could perform functions like open, save, exit, copy, cut, font, and about. The code presented implements these functions using Windows forms and allows the user to open, save, edit text, and change font and background color in the application. The conclusion states that the lab provided good experience with C# and the requirements were met by creating a basic notepad application.

Uploaded by

Cobilas Vasile
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

Notepad C# Prog Windows

The document describes a lab report on creating a notepad application in C#. The purpose of the lab was to study methods and principles for creating a notepad. The task was to create a notepad that could perform functions like open, save, exit, copy, cut, font, and about. The code presented implements these functions using Windows forms and allows the user to open, save, edit text, and change font and background color in the application. The conclusion states that the lab provided good experience with C# and the requirements were met by creating a basic notepad application.

Uploaded by

Cobilas Vasile
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Universitatea Tehnic a Moldovei

Departamentul ISA

Disciplina: Programarea n Windows

RAPORT
Lucrare de laborator nr.
Tema: Notepad

A efectuat:
A verificat: conf. univ.dr Besliu V.

Chiinu 2017
Scopul lucrrii: De a studia metodele i principiile de creare a unui notepad in limbajul de programare
dorit .

Sarcina lucrrii: de creat un notepad , unde sa putem opera cu asa functii cum ar fi :Open , SAVE ,
Exit,Copy,Cut,Font, About.

Codul surs:
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;

namespace lab8
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void nouToolStripMenuItem_Click(object sender, EventArgs e)


{
richTextBox1.Clear();
}

private void ieireToolStripMenuItem_Click(object sender, EventArgs e)


{
Application.Exit();
}

private void deschideToolStripMenuItem_Click(object sender, EventArgs e)


{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "Text files (.txt)|*.txt";
ofd.Title = "Open a file...";
if (ofd.ShowDialog() == DialogResult.OK)
{
System.IO.StreamReader sr = new System.IO.StreamReader(ofd.FileName);
richTextBox1.Text = sr.ReadToEnd();
sr.Close();
}
}

private void salveazToolStripMenuItem_Click(object sender, EventArgs e)


{
SaveFileDialog svf = new SaveFileDialog();
svf.Filter = "Text files (.txt)|*.txt";
svf.Title = "Save a file...";
if (svf.ShowDialog() == DialogResult.OK)
{
System.IO.StreamWriter sw = new System.IO.StreamWriter(svf.FileName);
sw.Write(richTextBox1.Text);
sw.Close();
}
}

private void napoiToolStripMenuItem_Click(object sender, EventArgs e)


{
richTextBox1.Undo();
}
private void taieToolStripMenuItem_Click(object sender, EventArgs e)
{
richTextBox1.Cut();
}

private void copieToolStripMenuItem_Click(object sender, EventArgs e)


{
richTextBox1.Copy();
}

private void insereazToolStripMenuItem_Click(object sender, EventArgs e)


{
richTextBox1.Paste();
}

private void selectareTotalToolStripMenuItem_Click(object sender, EventArgs e)


{
richTextBox1.SelectAll();
}

private void despreToolStripMenuItem_Click(object sender, EventArgs e)


{
MessageBox.Show("Ver 1.0 Created by");
}

private void personalizareToolStripMenuItem_Click(object sender, EventArgs e)


{
FontDialog fd = new FontDialog();
fd.Font = richTextBox1.SelectionFont;
if (fd.ShowDialog() == DialogResult.OK)
{
richTextBox1.SelectionFont = fd.Font;
}
}

private void opiuniToolStripMenuItem_Click(object sender, EventArgs e)


{
ColorDialog cr = new ColorDialog();
if (cr.ShowDialog() == DialogResult.OK)
{
richTextBox1.BackColor = cr.Color;
}
}

}
}
Rezultatul execuiei programului:

Concluzii: n timpul efectuarii laboratorului dat ,am obtinut o experienta mai buna in lucru cu limbajul
C#. Limbajul ales a permis crearea unei aplicatii mai compacte in o perioada de timp mica si cu eforturi
minime. Am implimentat cerintele lucrarii de laborator , in urma carora am creat un notepad cu
posibilitatea de a deschide, salva un document ,posibilitatea de a copia a sterge un text , dar si posibilitatea
de a modifica fontul si backgraund-ul aplicatiei .In final am creat butonul about care detine informatie
despre versiunea si fndatorul aplicatiei .

You might also like