Hey this is my codeI want to make the "Marked" text to change only when i use these buttons. (Color and fonts)Code: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; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void richTextBox1_TextChanged(object sender, EventArgs e) { } private void openToolStripButton_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "*.txt,*.rtf|*.txt;*.rtf"; if (dialog.ShowDialog() == DialogResult.OK) { string fileName = dialog.FileName; if (fileName.Length > 0) { richTextBox1.LoadFile(fileName, GetStreamType(fileName)); } } } private RichTextBoxStreamType GetStreamType(string fileName) { return fileName.EndsWith("rtf") ? RichTextBoxStreamType.RichText : RichTextBoxStreamType.PlainText; } private void saveToolStripButton_Click(object sender, EventArgs e) { SaveFileDialog dialog = new SaveFileDialog(); dialog.Filter = "*.txt,*.rtf|*.txt;*.rtf"; if (dialog.ShowDialog() == DialogResult.OK) { string fileName = dialog.FileName; richTextBox1.SaveFile(fileName, GetStreamType(dialog.FileName)); } } private void newToolStripButton_Click(object sender, EventArgs e) { richTextBox1.Clear(); } private void printToolStripButton_Click(object sender, EventArgs e) { printDialog1.ShowDialog(); } private void toolStripButton1_Click(object sender, EventArgs e) { colorDialog1.ShowDialog(); richTextBox1.ForeColor = colorDialog1.Color; } private void toolStripButton2_Click(object sender, EventArgs e) { fontDialog1.ShowDialog(); richTextBox1.Font = fontDialog1.Font; } } }
Thank you for helping me.
Mike




Reply With Quote