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.Threading.Tasks;
- using System.Windows.Forms;
- using System.IO;
- namespace Vezba_08_2017
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void fontToolStripMenuItem_Click(object sender, EventArgs e)
- {
- FontDialog fontDialog = new FontDialog();
- if(fontDialog.ShowDialog() == DialogResult.OK)
- {
- textBox1.Font = fontDialog.Font;
- }
- }
- private void colorToolStripMenuItem_Click(object sender, EventArgs e)
- {
- ColorDialog colorDialog = new ColorDialog();
- if(colorDialog.ShowDialog() == DialogResult.OK)
- {
- textBox1.ForeColor = colorDialog.Color;
- }
- }
- private void addToolStripMenuItem_Click(object sender, EventArgs e)
- {
- AddForm add = new AddForm();
- if(add.ShowDialog() == DialogResult.OK)
- {
- Osoba o = add.PodaciOOsobi;
- textBox1.Text += string.Format("{0} {1} rodjen {2} u {3}", o.Ime, o.Prezime, o.DatumRodjenja.ToShortDateString(), o.MestoRodjenja);
- }
- }
- private void folderToolStripMenuItem_Click(object sender, EventArgs e)
- {
- FolderBrowserDialog folderDialog = new FolderBrowserDialog();
- folderDialog.ShowDialog();
- }
- private void openToolStripMenuItem_Click(object sender, EventArgs e)
- {
- OpenFileDialog openDialog = new OpenFileDialog();
- openDialog.Filter = "Tekstualne datoteke (*.txt)|*.txt|Sve datoteke (*.*)|*.*";
- if (openDialog.ShowDialog() == DialogResult.OK)
- {
- textBox1.Text = File.ReadAllText(openDialog.FileName);
- }
- }
- private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
- {
- SaveFileDialog saveDialog = new SaveFileDialog();
- saveDialog.Filter = "Tekstualne datoteke (*.txt)|*.txt|Sve datoteke (*.*)|*.*";
- if (saveDialog.ShowDialog() == DialogResult.OK)
- {
- File.WriteAllText(saveDialog.FileName, textBox1.Text);
- }
- }
- private void pageSetupToolStripMenuItem_Click(object sender, EventArgs e)
- {
- PageSetupDialog pageDialog = new PageSetupDialog();
- pageDialog.ShowDialog();
- }
- private void printToolStripMenuItem_Click(object sender, EventArgs e)
- {
- PrintDialog printDialog = new PrintDialog();
- printDialog.ShowDialog();
- }
- private void exitToolStripMenuItem_Click(object sender, EventArgs e)
- {
- Close();
- }
- private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
- {
- AboutForm about = new AboutForm();
- about.ShowDialog();
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Vezba_08_2017
- {
- public class Osoba
- {
- public string Ime { get; set; }
- public string Prezime { get; set; }
- public string MestoRodjenja { get; set; }
- public DateTime DatumRodjenja { get; set; }
- }
- }
- 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 Vezba_08_2017
- {
- public partial class AboutForm : Form
- {
- public AboutForm()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- DialogResult = DialogResult.OK;
- Close();
- }
- }
- }
- 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 Vezba_08_2017
- {
- public partial class AddForm : Form
- {
- public Osoba PodaciOOsobi { get; private set; }
- public AddForm()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- PodaciOOsobi = new Osoba();
- PodaciOOsobi.Ime = textBox1.Text;
- PodaciOOsobi.Prezime = textBox2.Text;
- PodaciOOsobi.MestoRodjenja = textBox3.Text;
- PodaciOOsobi.DatumRodjenja = dateTimePicker1.Value;
- DialogResult = DialogResult.OK;
- Close();
- }
- private void button2_Click(object sender, EventArgs e)
- {
- DialogResult = DialogResult.Cancel;
- Close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment