public void SetInitText(Font f, Color c, Color bc, int interval, string s, int speed, double transp, bool tans) { //timer1.Start(); this.f = f; this.c = c; this.bc = bc; this.Interval = interval; this.text = s; this.speed = speed; this.Transp = transp; if (tans) { tans_Flag = true; } else { tans_Flag = false; } bf = new Form_RunText(languageFile); bf.Size = this.Size;//同步宽度 this.BackColor = bc; if (tans_Flag) { //Console.WriteLine(Transp); subColorToolStripMenuItem.Enabled = false; this.Opacity = Transp;//背景窗体透明 this.TopMost = true; //bf.TopMost = true; //bf.BackColor = Color.Blue;//设置主窗体透明颜色 这里我是随便设的 大家可以找个用不到的颜色来设置透明色 //bf.TransparencyKey = Color.Blue;//将指定颜色设置为透明色 if (bc == Color.White) { this.TransparencyKey = Color.Black; } else { this.TransparencyKey = Color.White; } } else { subColorToolStripMenuItem.Enabled = true; bf.BackColor = bc; //设置主窗体透明颜色 这里我是随便设的 大家可以找个用不到的颜色来设置透明色 bf.TransparencyKey = bc; //将指定颜色设置为透明色 } //Console.WriteLine("122222221"); }
private void button1_Click(object sender, EventArgs e) { //label1.Text = richTextBox1.Text; temp = richTextBox1.Text; //if (temp.Equals("")) //{ // if (mf) // MessageBox.Show("Please enter the captions you want to display.!", "Tips"); // else // MessageBox.Show("请输入需要显示的字幕!", "提示"); // return; //} spd = (int)numericUpDown1.Value; speed = (int)numericUpDown2.Value; double tan = (double)slider1.Value / 100; if (checkBox1.Checked) { ft = new Form_BText(languageFile); ft.SetInitText(f, c, bc, spd, temp, speed, tan, true); ft.Show(); formList.Add(ft); } else { Form_RunText bf = new Form_RunText(languageFile); if (checkBox3.Checked) { bf.SetInitText(f, c, bc, spd, temp, speed, tan, false, true); } else { bf.SetInitText(f, c, bc, spd, temp, speed, tan, false, false); } bf.Show(); } if (temp.Contains("\n")) { temp = temp.Replace("\n", "*"); } settingFile.WriteString("SUBSET", "TEXTNAME", temp); settingFile.WriteInteger("SUBSET", "MOVETIME", spd); settingFile.WriteInteger("SUBSET", "MOVESPEED", speed); settingFile.WriteInteger("SUBSET", "MOVETANS", slider1.Value); settingFile.WriteInteger("SUBSET", "FONTC", colorDropDownList1.SelectedIndex); }