development of note pad

15
NOTEPAD APPLICATION DEVELOPMENT IN C# Visual Programming 1 Hamza Gulistan

Upload: comstas

Post on 13-Jan-2017

71 views

Category:

Engineering


0 download

TRANSCRIPT

Page 1: Development of note pad

Visual Programming 1

NOTEPAD APPLICATION DEVELOPMENT IN C#

Hamza Gulistan

Page 2: Development of note pad

05/01/2023 Visual Programming 2

start1. open your visual c# 2008/2010/2012/2015

2.create a new project and name it NotePad or better UrFirstName_NotePad

3.edit form properties like text as “NotePad” and name it as frmNotePad

4. now go to toolbox and grab richTextBox control inside the form and name it as rtb_NotePad

Page 3: Development of note pad

05/01/2023 Visual Programming 3

Dock What is Dock? What should be dock for the

rtb_NotePad? And why?

Add MenuStrip1 and name it as mnuNotePad

And then create the menuStrip items as given in next slide.

Page 4: Development of note pad

MenuItems

Edit Cut Copy Paste - DateT

ime Select

All - Undo Redo

05/01/2023 Visual Programming 4

O FileO New O Ope

nO SaveO -O Exit

O FormatO wordWra

p O FontO Color

O ViewO StatusBarO -O CentreO LeftO Right

O AboutO AboutUs

Page 5: Development of note pad

05/01/2023 Visual Programming 5

Dialogs

Doule Click and include the following Components in your form OpenFileDialog SaveFileDialog FontDialog ColorDialog Etc

Page 6: Development of note pad

05/01/2023 Visual Programming 6

After This, add the events and code and Learn it.

Page 7: Development of note pad

05/01/2023 Visual Programming 7

Page 8: Development of note pad

05/01/2023 Visual Programming 8

saveprivate void saveToolStripMenuItem_Click(object sender, EventArgs e) { dlg_save.Title = "Save As"; dlg_save.Filter = "Text Document|*.txt";//applied filter dlg_save.DefaultExt = "txt";//applied default extension if (dlg_save.ShowDialog() == DialogResult.OK) { rtb_NotePad.SaveFile(dlg_save.FileName, RichTextBoxStreamType.PlainText); this.Text = dlg_save.FileName; } }

Page 9: Development of note pad

05/01/2023 Visual Programming 9

Page 10: Development of note pad

05/01/2023 Visual Programming 10

Page 11: Development of note pad

05/01/2023 Visual Programming 11

Can learn for different ForeColor and BackColor too.

Page 12: Development of note pad

05/01/2023 Visual Programming 12

Page 13: Development of note pad

05/01/2023 Visual Programming 13

Add the Alignment Code for Centre, Left and Right separately

private void centreToolStripMenuItem_Click(object sender, EventArgs e) { rtb_NotePad.SelectionAlignment = HorizontalAlignment.Center; }

Page 14: Development of note pad

05/01/2023 Visual Programming 14

After This, Add the Code for Following as Learning

WordWrap PrintDialog PrintPreviewDialog