fix up notepad + wordpad

This commit is contained in:
lempamo 2017-07-10 23:02:08 -04:00
parent fa899ea6ad
commit 4a5a6d38a4
6 changed files with 22 additions and 142 deletions

View file

@ -320,7 +320,7 @@ private void InitializeComponent()
// mainText // mainText
// //
this.mainText.Dock = System.Windows.Forms.DockStyle.Fill; this.mainText.Dock = System.Windows.Forms.DockStyle.Fill;
this.mainText.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.mainText.Font = new System.Drawing.Font("Courier", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.mainText.Location = new System.Drawing.Point(0, 24); this.mainText.Location = new System.Drawing.Point(0, 24);
this.mainText.MaxLength = 131072; this.mainText.MaxLength = 131072;
this.mainText.Multiline = true; this.mainText.Multiline = true;

View file

@ -20,7 +20,7 @@ public WinClassicNotepad()
InitializeComponent(); InitializeComponent();
foreach (ToolStripMenuItem item in menuStrip1.Items) foreach (ToolStripMenuItem item in menuStrip1.Items)
{ {
item.Font = new Font(TitleScreen.pfc.Families[0], 16F, FontStyle.Regular, GraphicsUnit.Point, ((0))); item.Font = new Font(TitleScreen.pfc.Families[0], 16F, FontStyle.Regular);
item.BackColor = Color.Silver; item.BackColor = Color.Silver;
item.BackgroundImage = Properties.Resources.sliversilver; item.BackgroundImage = Properties.Resources.sliversilver;
item.BackgroundImageLayout = ImageLayout.Center; item.BackgroundImageLayout = ImageLayout.Center;
@ -91,8 +91,7 @@ private void openToolStripMenuItem_Click(object sender, EventArgs e)
try try
{ {
ActivateSaveFileDialog(".txt"); ActivateSaveFileDialog(".txt");
String selectedPath; string selectedPath = Program.OpenFileExplorerAsDialogAndReturnGivenPath();
selectedPath = Program.OpenFileExplorerAsDialogAndReturnGivenPath();
MessageBox.Show(selectedPath); MessageBox.Show(selectedPath);
if (selectedPath != "") if (selectedPath != "")
@ -110,8 +109,7 @@ private void saveToolStripMenuItem_Click(object sender, EventArgs e)
try try
{ {
ActivateSaveFileDialog(".txt"); ActivateSaveFileDialog(".txt");
String selectedPath; string selectedPath = Program.OpenFileExplorerAsDialogAndReturnGivenPath();
selectedPath = Program.OpenFileExplorerAsDialogAndReturnGivenPath();
MessageBox.Show(selectedPath); MessageBox.Show(selectedPath);
if (selectedPath != "") if (selectedPath != "")

View file

@ -117,7 +117,4 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>

View file

@ -152,7 +152,6 @@ private void InitializeComponent()
this.undoToolStripMenuItem.Name = "undoToolStripMenuItem"; this.undoToolStripMenuItem.Name = "undoToolStripMenuItem";
this.undoToolStripMenuItem.Size = new System.Drawing.Size(122, 22); this.undoToolStripMenuItem.Size = new System.Drawing.Size(122, 22);
this.undoToolStripMenuItem.Text = "Undo"; this.undoToolStripMenuItem.Text = "Undo";
this.undoToolStripMenuItem.Click += new System.EventHandler(this.undoToolStripMenuItem_Click);
// //
// toolStripSeparator2 // toolStripSeparator2
// //
@ -164,21 +163,18 @@ private void InitializeComponent()
this.cutToolStripMenuItem.Name = "cutToolStripMenuItem"; this.cutToolStripMenuItem.Name = "cutToolStripMenuItem";
this.cutToolStripMenuItem.Size = new System.Drawing.Size(122, 22); this.cutToolStripMenuItem.Size = new System.Drawing.Size(122, 22);
this.cutToolStripMenuItem.Text = "Cut"; this.cutToolStripMenuItem.Text = "Cut";
this.cutToolStripMenuItem.Click += new System.EventHandler(this.cutToolStripMenuItem_Click);
// //
// copyToolStripMenuItem // copyToolStripMenuItem
// //
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem"; this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
this.copyToolStripMenuItem.Size = new System.Drawing.Size(122, 22); this.copyToolStripMenuItem.Size = new System.Drawing.Size(122, 22);
this.copyToolStripMenuItem.Text = "Copy"; this.copyToolStripMenuItem.Text = "Copy";
this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
// //
// pasteToolStripMenuItem // pasteToolStripMenuItem
// //
this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem"; this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem";
this.pasteToolStripMenuItem.Size = new System.Drawing.Size(122, 22); this.pasteToolStripMenuItem.Size = new System.Drawing.Size(122, 22);
this.pasteToolStripMenuItem.Text = "Paste"; this.pasteToolStripMenuItem.Text = "Paste";
this.pasteToolStripMenuItem.Click += new System.EventHandler(this.pasteToolStripMenuItem_Click);
// //
// toolStripSeparator3 // toolStripSeparator3
// //
@ -190,14 +186,12 @@ private void InitializeComponent()
this.clearToolStripMenuItem.Name = "clearToolStripMenuItem"; this.clearToolStripMenuItem.Name = "clearToolStripMenuItem";
this.clearToolStripMenuItem.Size = new System.Drawing.Size(122, 22); this.clearToolStripMenuItem.Size = new System.Drawing.Size(122, 22);
this.clearToolStripMenuItem.Text = "Clear"; this.clearToolStripMenuItem.Text = "Clear";
this.clearToolStripMenuItem.Click += new System.EventHandler(this.clearToolStripMenuItem_Click);
// //
// selectAllToolStripMenuItem // selectAllToolStripMenuItem
// //
this.selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem"; this.selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem";
this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(122, 22); this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(122, 22);
this.selectAllToolStripMenuItem.Text = "Select All"; this.selectAllToolStripMenuItem.Text = "Select All";
this.selectAllToolStripMenuItem.Click += new System.EventHandler(this.selectAllToolStripMenuItem_Click);
// //
// viewToolStripMenuItem // viewToolStripMenuItem
// //
@ -217,7 +211,6 @@ private void InitializeComponent()
this.toolbarToolStripMenuItem.Name = "toolbarToolStripMenuItem"; this.toolbarToolStripMenuItem.Name = "toolbarToolStripMenuItem";
this.toolbarToolStripMenuItem.Size = new System.Drawing.Size(132, 22); this.toolbarToolStripMenuItem.Size = new System.Drawing.Size(132, 22);
this.toolbarToolStripMenuItem.Text = "Toolbar"; this.toolbarToolStripMenuItem.Text = "Toolbar";
this.toolbarToolStripMenuItem.Click += new System.EventHandler(this.toolbarToolStripMenuItem_Click);
// //
// formatBarToolStripMenuItem // formatBarToolStripMenuItem
// //
@ -227,7 +220,6 @@ private void InitializeComponent()
this.formatBarToolStripMenuItem.Name = "formatBarToolStripMenuItem"; this.formatBarToolStripMenuItem.Name = "formatBarToolStripMenuItem";
this.formatBarToolStripMenuItem.Size = new System.Drawing.Size(132, 22); this.formatBarToolStripMenuItem.Size = new System.Drawing.Size(132, 22);
this.formatBarToolStripMenuItem.Text = "Format Bar"; this.formatBarToolStripMenuItem.Text = "Format Bar";
this.formatBarToolStripMenuItem.Click += new System.EventHandler(this.formatBarToolStripMenuItem_Click);
// //
// statusBarToolStripMenuItem // statusBarToolStripMenuItem
// //
@ -237,7 +229,6 @@ private void InitializeComponent()
this.statusBarToolStripMenuItem.Name = "statusBarToolStripMenuItem"; this.statusBarToolStripMenuItem.Name = "statusBarToolStripMenuItem";
this.statusBarToolStripMenuItem.Size = new System.Drawing.Size(132, 22); this.statusBarToolStripMenuItem.Size = new System.Drawing.Size(132, 22);
this.statusBarToolStripMenuItem.Text = "Status Bar"; this.statusBarToolStripMenuItem.Text = "Status Bar";
this.statusBarToolStripMenuItem.Click += new System.EventHandler(this.statusBarToolStripMenuItem_Click);
// //
// insertToolStripMenuItem // insertToolStripMenuItem
// //
@ -252,7 +243,6 @@ private void InitializeComponent()
this.dateTimeToolStripMenuItem.Name = "dateTimeToolStripMenuItem"; this.dateTimeToolStripMenuItem.Name = "dateTimeToolStripMenuItem";
this.dateTimeToolStripMenuItem.Size = new System.Drawing.Size(130, 22); this.dateTimeToolStripMenuItem.Size = new System.Drawing.Size(130, 22);
this.dateTimeToolStripMenuItem.Text = "Date/Time"; this.dateTimeToolStripMenuItem.Text = "Date/Time";
this.dateTimeToolStripMenuItem.Click += new System.EventHandler(this.dateTimeToolStripMenuItem_Click);
// //
// formatToolStripMenuItem // formatToolStripMenuItem
// //
@ -330,7 +320,6 @@ private void InitializeComponent()
this.btnPaste.Size = new System.Drawing.Size(26, 23); this.btnPaste.Size = new System.Drawing.Size(26, 23);
this.btnPaste.TabIndex = 1; this.btnPaste.TabIndex = 1;
this.btnPaste.UseVisualStyleBackColor = true; this.btnPaste.UseVisualStyleBackColor = true;
this.btnPaste.Click += new System.EventHandler(this.btnPaste_Click);
// //
// btnCopy // btnCopy
// //
@ -341,7 +330,6 @@ private void InitializeComponent()
this.btnCopy.Size = new System.Drawing.Size(26, 23); this.btnCopy.Size = new System.Drawing.Size(26, 23);
this.btnCopy.TabIndex = 1; this.btnCopy.TabIndex = 1;
this.btnCopy.UseVisualStyleBackColor = true; this.btnCopy.UseVisualStyleBackColor = true;
this.btnCopy.Click += new System.EventHandler(this.btnCopy_Click);
// //
// btnCut // btnCut
// //
@ -352,7 +340,6 @@ private void InitializeComponent()
this.btnCut.Size = new System.Drawing.Size(26, 23); this.btnCut.Size = new System.Drawing.Size(26, 23);
this.btnCut.TabIndex = 1; this.btnCut.TabIndex = 1;
this.btnCut.UseVisualStyleBackColor = true; this.btnCut.UseVisualStyleBackColor = true;
this.btnCut.Click += new System.EventHandler(this.btnCut_Click);
// //
// btnNew // btnNew
// //
@ -507,7 +494,7 @@ private void InitializeComponent()
// //
// WinClassicWordPad // WinClassicWordPad
// //
this.BackColor = System.Drawing.SystemColors.Control; this.BackColor = System.Drawing.Color.Silver;
this.Controls.Add(this.statusBar); this.Controls.Add(this.statusBar);
this.Controls.Add(this.mainText); this.Controls.Add(this.mainText);
this.Controls.Add(this.pnlFormatBar); this.Controls.Add(this.pnlFormatBar);

View file

@ -42,6 +42,20 @@ public WinClassicWordPad()
comboFont.Items.Add(font.Name); comboFont.Items.Add(font.Name);
} }
this.clearToolStripMenuItem.Click += (sender, args) => mainText.Text = mainText.Text.Remove(mainText.SelectionStart, mainText.SelectedText.Length);
this.pasteToolStripMenuItem.Click += (sender, args) => mainText.Paste();
this.btnPaste.Click += (sender, args) => mainText.Paste();
this.btnCopy.Click += (sender, args) => { if (mainText.SelectedText.Length >= 0) mainText.Copy(); };
this.copyToolStripMenuItem.Click += (sender, args) => { if (mainText.SelectedText.Length >= 0) mainText.Copy(); };
this.cutToolStripMenuItem.Click += (sender, args) => { if (mainText.SelectedText.Length >= 0) mainText.Cut(); };
this.btnCut.Click += (sender, args) => { if (mainText.SelectedText.Length >= 0) mainText.Cut(); };
this.undoToolStripMenuItem.Click += (sender, args) => mainText.Undo();
this.selectAllToolStripMenuItem.Click += (sender, args) => mainText.SelectAll();
this.dateTimeToolStripMenuItem.Click += (sender, args) => mainText.AppendText(DateTime.Now.ToString("HH:mm tt dd/MM/yyyy"));
this.toolbarToolStripMenuItem.Click += (sender, args) => pnlToolbar.Visible = toolbarToolStripMenuItem.Checked;
this.formatBarToolStripMenuItem.Click += (sender, args) => pnlFormatBar.Visible = formatBarToolStripMenuItem.Checked;
this.statusBarToolStripMenuItem.Click += (sender, args) => statusBar.Visible = statusBarToolStripMenuItem.Checked;
} }
#region Format_Buttons #region Format_Buttons
@ -96,24 +110,6 @@ private void btnUnderline_Click(object sender, EventArgs e)
#endregion #endregion
#region Designer-Stuff #region Designer-Stuff
private void dateTimeToolStripMenuItem_Click(object sender, EventArgs e)
{
InsertDateTime();
}
private void toolbarToolStripMenuItem_Click(object sender, EventArgs e)
{
pnlToolbar.Visible = toolbarToolStripMenuItem.Checked;
}
private void formatBarToolStripMenuItem_Click(object sender, EventArgs e)
{
pnlFormatBar.Visible = formatBarToolStripMenuItem.Checked;
}
private void statusBarToolStripMenuItem_Click(object sender, EventArgs e)
{
statusBar.Visible = statusBarToolStripMenuItem.Checked;
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e) private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{ {
@ -140,81 +136,6 @@ private void sendToolStripMenuItem_Click(object sender, EventArgs e)
wm.StartInfobox95("Wordpad", "An error occured opening send option.", null); wm.StartInfobox95("Wordpad", "An error occured opening send option.", null);
} }
void Cut()
{
if (mainText.SelectedText.Length >= 0) {
mainText.Cut();
}
}
void Copy()
{
if (mainText.SelectedText.Length >= 0)
{
mainText.Copy();
}
}
void Paste()
{
mainText.Paste();
}
void Clear()
{
mainText.Text = mainText.Text.Remove(mainText.SelectionStart, mainText.SelectedText.Length);
}
void SelectAll()
{
mainText.SelectAll();
}
private void undoToolStripMenuItem_Click(object sender, EventArgs e)
{
Undo();
}
private void cutToolStripMenuItem_Click(object sender, EventArgs e)
{
Cut();
}
private void copyToolStripMenuItem_Click(object sender, EventArgs e)
{
Copy();
}
private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
{
Paste();
}
private void selectAllToolStripMenuItem_Click(object sender, EventArgs e)
{
SelectAll();
}
private void clearToolStripMenuItem_Click(object sender, EventArgs e)
{
Clear();
}
private void btnCut_Click(object sender, EventArgs e)
{
Cut();
}
private void btnCopy_Click(object sender, EventArgs e)
{
Copy();
}
private void btnPaste_Click(object sender, EventArgs e)
{
Paste();
}
private void bulletStyleToolStripMenuItem_Click(object sender, EventArgs e) private void bulletStyleToolStripMenuItem_Click(object sender, EventArgs e)
{ {
mainText.SelectionBullet = bulletStyleToolStripMenuItem.Checked; mainText.SelectionBullet = bulletStyleToolStripMenuItem.Checked;
@ -265,17 +186,6 @@ void NewFile()
mainText.Text = ""; mainText.Text = "";
} }
void Undo()
{
mainText.Undo();
}
void InsertDateTime()
{
string DateTime = System.DateTime.Now.ToString("HH:mm tt dd/MM/yyyy");
mainText.AppendText(DateTime);
}
// Things for Cut/Copy/Paste have been placed in the "Designer-Stuff" region! // Things for Cut/Copy/Paste have been placed in the "Designer-Stuff" region!
void SetSelectedTextFont(String font) void SetSelectedTextFont(String font)
@ -300,18 +210,9 @@ void DoFontStyles()
FontStyle Bold = FontStyle.Regular; FontStyle Bold = FontStyle.Regular;
FontStyle Italic = FontStyle.Regular; FontStyle Italic = FontStyle.Regular;
FontStyle Underline = FontStyle.Regular; FontStyle Underline = FontStyle.Regular;
if (doBold == true) if (doBold == true) Bold = FontStyle.Bold;
{ if (doItalic == true) Italic = FontStyle.Italic;
Bold = FontStyle.Bold; if (doUnderline == true)Underline = FontStyle.Underline;
}
if (doItalic == true)
{
Italic = FontStyle.Italic;
}
if (doUnderline == true)
{
Underline = FontStyle.Underline;
}
mainText.SelectionFont = new Font(mainText.SelectionFont.FontFamily, mainText.SelectionFont.Size, Bold | Italic | Underline); mainText.SelectionFont = new Font(mainText.SelectionFont.FontFamily, mainText.SelectionFont.Size, Bold | Italic | Underline);
} }
} }

View file

@ -117,7 +117,4 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="topmenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>