private void fontToolStripMenuItem_Click(object sender, EventArgs e) { Form tmp = this.ActiveMdiChild; if (tmp == null) { return; } if (tmp is RtfEditor) { RtfEditor rtf = (RtfEditor)tmp; fontDialog1.Font = rtf.RtdSelectionFont; if (fontDialog1.ShowDialog() == DialogResult.OK) { rtf.RtdSelectionFont = fontDialog1.Font; } } else { TxtEditor txt = (TxtEditor)tmp; fontDialog1.Font = txt.TxbSelectionFont; if (fontDialog1.ShowDialog() == DialogResult.OK) { txt.TxbSelectionFont = fontDialog1.Font; } } }
private void createNewtxtFileToolStripMenuItem_Click(object sender, EventArgs e) { TxtEditor txt = new TxtEditor(); txt.MdiParent = this; txt.Show(); txt.TxbSelectionFont = new Font("Times New Roman", 12); tscbFontStyles.Text = txt.TxbFontName; tscbFontSize.Text = txt.TxbFontSize.ToString(); }
private void opentxtFilesToolStripMenuItem_Click(object sender, EventArgs e) { TxtEditor txt = new TxtEditor() { MdiParent = this }; if (txt.OpenFile() == DialogResult.OK) { txt.Show(); tscbFontStyles.Text = txt.TxbFontName; tscbFontSize.Text = txt.TxbFontSize.ToString(); } }
private void bPodcherk_Click(object sender, EventArgs e) { Form tmp = this.ActiveMdiChild; if (tmp is RtfEditor) { RtfEditor rtf = (RtfEditor)tmp; rtf.Podcherk_Click(); } else { TxtEditor txt = (TxtEditor)tmp; txt.Podcherk_Click(); } }
private void tscbFontSize_SelectedIndexChanged(object sender, EventArgs e) { Form tmp = this.ActiveMdiChild; if (tmp is RtfEditor) { RtfEditor rtf = (RtfEditor)tmp; if (tscbFontStyles.SelectedIndex != -1 && tscbFontSize.SelectedIndex != -1) { rtf.RtdSelectionFont = new Font(tscbFontStyles.SelectedItem.ToString(), int.Parse(tscbFontSize.SelectedItem.ToString()), rtf.RdtStyle); } } else { TxtEditor txt = (TxtEditor)tmp; if (tscbFontStyles.SelectedIndex != -1 && tscbFontSize.SelectedIndex != -1) { txt.TxbSelectionFont = new Font(tscbFontStyles.SelectedItem.ToString(), int.Parse(tscbFontSize.SelectedItem.ToString()), txt.TxbStyle); } } }
private void colorToolStripMenuItem_Click(object sender, EventArgs e) { Form tmp = this.ActiveMdiChild; if (tmp is RtfEditor) { RtfEditor rtf = (RtfEditor)tmp; colorDialog1.Color = rtf.GetSetRtdSelectionColor; if (colorDialog1.ShowDialog() == DialogResult.OK) { rtf.GetSetRtdSelectionColor = colorDialog1.Color; } } else { TxtEditor txt = (TxtEditor)tmp; colorDialog1.Color = txt.GetSetTxtColor; if (colorDialog1.ShowDialog() == DialogResult.OK) { txt.GetSetTxtColor = colorDialog1.Color; } } }