Form2.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. using System;
  2. using System.Threading;
  3. using System.Windows.Forms;
  4. using 新一代CaptB点名器.Properties;
  5. namespace 新一代CaptB点名器
  6. {
  7. public partial class Form2 : Form
  8. {
  9. public Form2()
  10. {
  11. InitializeComponent();
  12. ActiveControl = button1;
  13. }
  14. private void Form2_Load(object sender, EventArgs e)
  15. {
  16. if (Settings.Default.doTransparent == true)
  17. {
  18. Opacity = (double)Settings.Default.Opacity / 100;
  19. checkBox1.Checked = true;
  20. }
  21. else
  22. {
  23. Opacity = 100;
  24. checkBox1.Checked = false;
  25. }
  26. if (Settings.Default.doTopmost == true)
  27. {
  28. TopMost = true;
  29. checkBox2.Checked = true;
  30. }
  31. else
  32. {
  33. TopMost = false;
  34. checkBox2.Checked = false;
  35. }
  36. if (Program.called_name == string.Empty)
  37. {
  38. textBox1.Text = Settings.Default.InitialWord;
  39. }
  40. else
  41. {
  42. textBox1.Text = Program.called_name;
  43. }
  44. }
  45. private void checkBox1_CheckStateChanged(object sender, EventArgs e)
  46. {
  47. if (checkBox1.Checked)
  48. {
  49. Settings.Default.doTransparent = true;
  50. Settings.Default.Save();
  51. Opacity = (double)Settings.Default.Opacity / 100;
  52. }
  53. else
  54. {
  55. Settings.Default.doTransparent = false;
  56. Settings.Default.Save();
  57. Opacity = 100;
  58. }
  59. }
  60. private void checkBox2_CheckStateChanged(object sender, EventArgs e)
  61. {
  62. if (checkBox2.Checked)
  63. {
  64. Settings.Default.doTopmost = true;
  65. Settings.Default.Save();
  66. TopMost = true;
  67. }
  68. else
  69. {
  70. Settings.Default.doTopmost = false;
  71. Settings.Default.Save();
  72. TopMost = false;
  73. }
  74. }
  75. private void button1_Click(object sender, EventArgs e)
  76. {
  77. Program.call();
  78. textBox1.Text = Program.called_name;
  79. }
  80. private void Form2_FormClosed(object sender, FormClosedEventArgs e)
  81. {
  82. new Form1(null).Show();
  83. }
  84. private void button2_Click(object sender, EventArgs e)
  85. {
  86. Program.Reset();
  87. textBox1.Text = Settings.Default.InitialWord;
  88. }
  89. private void Form2_MouseMove(object sender, MouseEventArgs e)
  90. {
  91. Height = 203;
  92. ActiveControl = button1;
  93. }
  94. private void 复制ToolStripMenuItem_Click(object sender, EventArgs e)
  95. {
  96. Clipboard.SetText(textBox1.Text);
  97. }
  98. }
  99. }