Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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.IO;
- namespace Texter_0._2
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
- }
- private void neuToolStripMenuItem_Click(object sender, EventArgs e)
- {
- if (tabControl1.SelectedIndex == 0)
- {
- TextBox.Clear();
- Tab1.Text = "Neues Dokument 1";
- }
- else if (tabControl1.SelectedIndex == 1)
- {
- TextBox2.Clear();
- Tab2.Text = "Neues Dokument 2";
- }
- }
- private void beendenToolStripMenuItem_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- private void öffnenToolStripMenuItem_Click(object sender, EventArgs e)
- {
- string open;
- openFileDialog1.Filter = "Alle (*.*) | *.*";
- openFileDialog1.FileName = "";
- if (openFileDialog1.ShowDialog(Owner) == DialogResult.OK)
- {
- open = openFileDialog1.FileName;
- if (tabControl1.SelectedIndex == 0)
- {
- TextBox.Text = File.ReadAllText(open);
- Tab1.Text = open;
- }
- else if (tabControl1.SelectedIndex == 1)
- {
- TextBox2.Text = File.ReadAllText(open);
- Tab2.Text = open;
- }
- }
- }
- private void ausschneidenToolStripMenuItem_Click(object sender, EventArgs e)
- {
- if (tabControl1.SelectedIndex == 0)
- {
- TextBox.Cut();
- }
- else if (tabControl1.SelectedIndex == 1)
- {
- TextBox2.Cut();
- }
- }
- private void kopierenToolStripMenuItem_Click(object sender, EventArgs e)
- {
- if (tabControl1.SelectedIndex == 0)
- {
- TextBox.Copy();
- }
- else if (tabControl1.SelectedIndex == 1)
- {
- TextBox2.Copy();
- }
- }
- private void einfügenToolStripMenuItem_Click(object sender, EventArgs e)
- {
- if (tabControl1.SelectedIndex == 0)
- {
- TextBox.Paste();
- }
- else if (tabControl1.SelectedIndex == 1)
- {
- TextBox2.Paste();
- }
- }
- private void speichernToolStripMenuItem_Click(object sender, EventArgs e)
- {
- string save, text, text2;
- text = TextBox.Text;
- text2 = TextBox2.Text;
- saveFileDialog1.Filter = "Textdateien (*.txt)|*.txt|Alle (*.*) | *.*";
- saveFileDialog1.FileName = "Neues Dokument";
- if (saveFileDialog1.ShowDialog(Owner) == DialogResult.OK)
- {
- save = saveFileDialog1.FileName;
- if (tabControl1.SelectedIndex == 0)
- {
- File.WriteAllText(save, text);
- }
- else if (tabControl1.SelectedIndex == 1)
- {
- File.WriteAllText(save, text2);
- }
- }
- }
- private void schriftToolStripMenuItem_Click(object sender, EventArgs e)
- {
- if (fontDialog1.ShowDialog(Owner) == DialogResult.OK)
- {
- TextBox.SelectionFont = fontDialog1.Font;
- }
- }
- private void infosToolStripMenuItem_Click(object sender, EventArgs e)
- {
- MessageBox.Show("Programmierer: Alexander Rudel \nDatum: 2012\nVersion: Beta 0.3.1", "Informationen",
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- private void Form1_FormClosing(object sender, FormClosingEventArgs e)
- {
- DialogResult result = MessageBox.Show("Wollen sie das Programm beenden?\nDenken sie an das speichern ihrer Dateien!", "Beenden", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
- if (result == DialogResult.Yes)
- {
- e.Cancel = false;
- }
- else if (result == DialogResult.No)
- {
- e.Cancel = true;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement