0% found this document useful (0 votes)
14 views2 pages

Zad1 Richtextbox, MenuStrip

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

Zad1 Richtextbox, MenuStrip

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

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 WindowsFormsApp10
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void noviTekstToolStripMenuItem_Click(object sender, EventArgs e)


{
richTextBox1.Clear();
}

private void otvoriToolStripMenuItem_Click(object sender, EventArgs e)


{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
richTextBox1.LoadFile(openFileDialog1.FileName,
RichTextBoxStreamType.PlainText);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
}

private void sacuvajToolStripMenuItem_Click(object sender, EventArgs e)


{
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
richTextBox1.SaveFile(saveFileDialog1.FileName,
RichTextBoxStreamType.PlainText);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
}

private void izlazToolStripMenuItem_Click(object sender, EventArgs e)


{
Application.Exit();
}

private void iseciToolStripMenuItem_Click(object sender, EventArgs e)


{
richTextBox1.Cut();
}

private void kopirajToolStripMenuItem_Click(object sender, EventArgs e)


{
richTextBox1.Copy();
}

private void zalepiToolStripMenuItem_Click(object sender, EventArgs e)


{
richTextBox1.Paste();
}

private void promeniBojuToolStripMenuItem_Click(object sender, EventArgs e)


{
if (colorDialog1.ShowDialog() == DialogResult.OK)
{
richTextBox1.ForeColor = colorDialog1.Color;
}
}

private void fontToolStripMenuItem_Click(object sender, EventArgs e)


{
if (fontDialog1.ShowDialog() == DialogResult.OK)
{
richTextBox1.Font = fontDialog1.Font;
}
}

private void richTextBox1_TextChanged(object sender, EventArgs e)


{
toolStripStatusLabel1.Text = "Broj znakova: " +

richTextBox1.TextLength.ToString();
}

private void bojuPozadineToolStripMenuItem_Click(object sender, EventArgs e)


{
if (colorDialog1.ShowDialog() == DialogResult.OK)
{
richTextBox1.BackColor = colorDialog1.Color;
}
}
}
}

You might also like