Thats how a new form looks likeCode:private void newToolStripButton_Click(object sender, EventArgs e) { mdiChild = new Form(); mdiChild.Text = "Unavngivet" + count.ToString(); +count.tostring(); mdiChild.MdiParent = this; editTextBox = new TextBox(); editTextBox.Multiline = true; editTextBox.Dock = DockStyle.Fill; mdiChild.Controls.Add(editTextBox); //Giver os lov til at redigere den mdiChild.Show(); count++; }
I want to change the target texts color
If it can help you, then my copy vode is here
And atlast my colordialogboks. It shows but wont work.Code:private void copyToolStripButton_Click(object sender, EventArgs e) { Form activeChildForm = this.ActiveMdiChild; if (activeChildForm != null) { TextBox activeTextBox = activeChildForm.ActiveControl as TextBox; if (activeTextBox != null) { activeTextBox.Copy(); } } }
Please help me as fast as possible. Also It is a .Txt document, if that helps..Code:private void toolStripButton1_Click(object sender, EventArgs e) { Form activeChildForm = this.ActiveMdiChild; if (activeChildForm != null) { TextBox activeTextBox = activeChildForm.ActiveControl as TextBox; if (activeTextBox != null) { ColorDialog colorDialog = new ColorDialog(); if (colorDialog.ShowDialog() != DialogResult.Cancel) { activeTextBox.ForeColor = colorDialog1.Color; } } }




Reply With Quote