AboutBox.cs
上传用户:szltgg
上传日期:2019-05-16
资源大小:604k
文件大小:7k
源码类别:

Telnet服务器

开发平台:

C#

  1. /*
  2. * Copyright (c) 2005 Poderosa Project, All Rights Reserved.
  3. * $Id: AboutBox.cs,v 1.2 2005/04/20 08:44:12 okajima Exp $
  4. */
  5. using System;
  6. using System.Diagnostics;
  7. using System.Reflection;
  8. using System.Drawing;
  9. using System.Collections;
  10. using System.ComponentModel;
  11. using System.Windows.Forms;
  12. namespace Poderosa.Forms
  13. {
  14. /// <summary>
  15. /// AboutBox 偺奣梫偺愢柧偱偡丅
  16. /// </summary>
  17. internal class AboutBox : System.Windows.Forms.Form
  18. {
  19. //private Image _bgImage;
  20. private System.Windows.Forms.Button _okButton;
  21. private System.Windows.Forms.TextBox _versionText;
  22. /// <summary>
  23. /// 昁梫側僨僓僀僫曄悢偱偡丅
  24. /// </summary>
  25. private System.ComponentModel.Container components = null;
  26. private System.Windows.Forms.PictureBox _pictureBox;
  27. private System.Windows.Forms.PictureBox _guevaraPicture;
  28. private System.Windows.Forms.Button _creditButton;
  29. private bool _guevaraMode;
  30. public AboutBox()
  31. {
  32. //
  33. // Windows 僼僅乕儉 僨僓僀僫 僒億乕僩偵昁梫偱偡丅
  34. //
  35. InitializeComponent();
  36. this.Text = GApp.Strings.GetString("Form.AboutBox.Text");
  37. _okButton.Text = GApp.Strings.GetString("Common.OK");
  38. _creditButton.Text = GApp.Strings.GetString("Form.AboutBox._creditButton");
  39. _guevaraMode = GApp.Options.GuevaraMode;
  40. //Guevara Mode
  41. if(_guevaraMode) {
  42. System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(AboutBox));
  43. this._creditButton.Visible = false;
  44. this._okButton.Location = new System.Drawing.Point(160, 216);
  45. this._versionText.BackColor = System.Drawing.Color.White;
  46. this._versionText.Location = new System.Drawing.Point(152, 8);
  47. this._pictureBox.Visible = false;
  48. this._guevaraPicture.Visible = true;
  49. this._guevaraPicture.Location = new Point(0,8);
  50. this._guevaraPicture.Size = new Size(280, 200);
  51. this.BackColor = System.Drawing.Color.White;
  52. this.ClientSize = new System.Drawing.Size(418, 240);
  53. }
  54. }
  55. /// <summary>
  56. /// 巊梡偝傟偰偄傞儕僜乕僗偵屻張棟傪幚峴偟傑偡丅
  57. /// </summary>
  58. protected override void Dispose( bool disposing )
  59. {
  60. if( disposing )
  61. {
  62. if(components != null)
  63. {
  64. components.Dispose();
  65. }
  66. }
  67. base.Dispose( disposing );
  68. }
  69. #region Windows Form Designer generated code
  70. /// <summary>
  71. /// 僨僓僀僫 僒億乕僩偵昁梫側儊僜僢僪偱偡丅偙偺儊僜僢僪偺撪梕傪
  72. /// 僐乕僪 僄僨傿僞偱曄峏偟側偄偱偔偩偝偄丅
  73. /// </summary>
  74. private void InitializeComponent()
  75. {
  76. System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(AboutBox));
  77. this._okButton = new System.Windows.Forms.Button();
  78. this._versionText = new System.Windows.Forms.TextBox();
  79. this._pictureBox = new System.Windows.Forms.PictureBox();
  80. this._guevaraPicture = new System.Windows.Forms.PictureBox();
  81. this._creditButton = new System.Windows.Forms.Button();
  82. this.SuspendLayout();
  83. // 
  84. // _okButton
  85. // 
  86. this._okButton.BackColor = System.Drawing.SystemColors.Control;
  87. this._okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
  88. this._okButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
  89. this._okButton.Location = new System.Drawing.Point(176, 192);
  90. this._okButton.Name = "_okButton";
  91. this._okButton.Size = new System.Drawing.Size(88, 23);
  92. this._okButton.TabIndex = 0;
  93. // 
  94. // _versionText
  95. // 
  96. this._versionText.BackColor = System.Drawing.SystemColors.Window;
  97. this._versionText.Location = new System.Drawing.Point(0, 88);
  98. this._versionText.Multiline = true;
  99. this._versionText.Name = "_versionText";
  100. this._versionText.ReadOnly = true;
  101. this._versionText.Size = new System.Drawing.Size(280, 96);
  102. this._versionText.TabIndex = 2;
  103. this._versionText.Text = "";
  104. // 
  105. // _pictureBox
  106. // 
  107. this._pictureBox.Image = ((System.Drawing.Image)(resources.GetObject("_pictureBox.Image")));
  108. this._pictureBox.Location = new System.Drawing.Point(0, 0);
  109. this._pictureBox.Name = "_pictureBox";
  110. this._pictureBox.Size = new System.Drawing.Size(280, 88);
  111. this._pictureBox.TabIndex = 3;
  112. this._pictureBox.TabStop = false;
  113. // 
  114. // _guevaraPicture
  115. // 
  116. this._guevaraPicture.Image = ((System.Drawing.Image)(resources.GetObject("_guevaraPicture.Image")));
  117. this._guevaraPicture.Location = new System.Drawing.Point(0, 216);
  118. this._guevaraPicture.Name = "_guevaraPicture";
  119. this._guevaraPicture.Size = new System.Drawing.Size(285, 400);
  120. this._guevaraPicture.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
  121. this._guevaraPicture.TabIndex = 4;
  122. this._guevaraPicture.TabStop = false;
  123. this._guevaraPicture.Visible = false;
  124. // 
  125. // _creditButton
  126. // 
  127. this._creditButton.BackColor = System.Drawing.SystemColors.Control;
  128. this._creditButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
  129. this._creditButton.Location = new System.Drawing.Point(8, 192);
  130. this._creditButton.Name = "_creditButton";
  131. this._creditButton.Size = new System.Drawing.Size(88, 23);
  132. this._creditButton.TabIndex = 5;
  133. this._creditButton.Click += new EventHandler(OnCreditButton);
  134. // 
  135. // AboutBox
  136. // 
  137. this.AcceptButton = this._okButton;
  138. this.AutoScaleBaseSize = new System.Drawing.Size(5, 12);
  139. this.CancelButton = this._okButton;
  140. this.ClientSize = new System.Drawing.Size(282, 224);
  141. this.Controls.Add(this._creditButton);
  142. this.Controls.Add(this._pictureBox);
  143. this.Controls.Add(this._versionText);
  144. this.Controls.Add(this._guevaraPicture);
  145. this.Controls.Add(this._okButton);
  146. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
  147. this.MaximizeBox = false;
  148. this.MinimizeBox = false;
  149. this.Name = "AboutBox";
  150. this.ShowInTaskbar = false;
  151. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
  152. this.Load += new System.EventHandler(this.OnLoad);
  153. this.ResumeLayout(false);
  154. }
  155. #endregion
  156. protected override void OnPaint(PaintEventArgs e) {
  157. base.OnPaint (e);
  158. }
  159. private void OnLoad(object sender, System.EventArgs e) {
  160. Assembly asm = Assembly.GetExecutingAssembly();
  161. string[] s = new string[5];
  162. s[0] = "Terminal Emulator <Poderosa>";
  163. s[1] = "Copyright(c) 2005 Poderosa Project. All Rights Reserved.";
  164. s[2] = "";
  165. object[] t = asm.GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
  166. s[3] = " Version : " + ((AssemblyDescriptionAttribute)t[0]).Description;
  167. s[4] = " CLR     : " + System.Environment.Version.ToString();
  168. _versionText.Lines = s;
  169. }
  170. private int _guevaraIndex;
  171. private const string _guevaraString = "guevara";
  172. protected override bool ProcessDialogChar(char charCode) {
  173. if('A'<=charCode && charCode<='Z') charCode = (char)('a'+charCode-'A');
  174. if(charCode==_guevaraString[_guevaraIndex]) {
  175. if(++_guevaraIndex==_guevaraString.Length) {
  176. if(!GApp.Options.GuevaraMode)
  177. GUtil.Warning(this, GApp.Strings.GetString("Message.AboutBox.EnterGuevara"));
  178. else
  179. GUtil.Warning(this, GApp.Strings.GetString("Message.AboutBox.ExitGuevara"));
  180. GApp.Options.GuevaraMode = !GApp.Options.GuevaraMode;
  181. GApp.Frame.ReloadIcon();
  182. this.Close();
  183. }
  184. }
  185. else
  186. _guevaraIndex = 0;
  187. return base.ProcessDialogChar (charCode);
  188. }
  189. private bool _credit;
  190. private void OnCreditButton(object sender, EventArgs args) {
  191. _credit = true;
  192. this.Close();
  193. }
  194. public bool CreditButtonClicked {
  195. get {
  196. return _credit;
  197. }
  198. }
  199. }
  200. }