private void ToolStripMenuItem_Click(object sender, EventArgs e) { ToolStripMenuItem item = sender as ToolStripMenuItem; FontDialog font = new FontDialog(); font.ShowColor = true; font.ShowEffects = true; int i = Convert.ToInt32(item.Name) - 1; FormConfig formconfig = list[i]; font.Font = formconfig.font; font.Color = formconfig.color; ShowWindow showwindow = dic[i]; if (font.ShowDialog() == System.Windows.Forms.DialogResult.OK) { formconfig.font = font.Font; showwindow.richTextBox1.Font = font.Font; showwindow.richTextBox1.ForeColor = font.Color; formconfig.color = font.Color; } showwindow.richTextBox1.Enabled = true; showwindow.trackBar1.Value = (int)(formconfig.alpha * 100); showwindow.trackBar1.Visible = true; showwindow.ShowEdit(formconfig); }
private void ShowWindows() { for (int i = 0; i < list.Count; i++) { ToolStripMenuItem item = new ToolStripMenuItem(); item.Name = (i + 1) + ""; item.Size = new System.Drawing.Size(152, 22); item.Text = "设置窗口" + (i + 1); item.Click += new System.EventHandler(this.ToolStripMenuItem_Click); contextMenuStrip1.Items.Insert(1, item); ShowWindow swindow = new ShowWindow(this); swindow.Text = "关闭自动保存"; swindow.richTextBox1.Text = list[i].text; swindow.richTextBox1.Font = list[i].font; swindow.richTextBox1.ForeColor = list[i].color; swindow.Opacity = list[i].alpha; swindow.Size = list[i].size; swindow.Location = list[i].location; dic.Add(i, swindow); swindow.Show(); } }