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

Telnet服务器

开发平台:

C#

  1. /*
  2. * Copyright (c) 2005 Poderosa Project, All Rights Reserved.
  3. * $Id: WarningWithDisableOption.cs,v 1.2 2005/04/20 08:45:48 okajima Exp $
  4. */
  5. using System;
  6. using System.Drawing;
  7. using System.Collections;
  8. using System.ComponentModel;
  9. using System.Windows.Forms;
  10. using Poderosa;
  11. namespace Poderosa.Forms
  12. {
  13. /// <summary>
  14. /// WarningWithDisableOption 偺奣梫偺愢柧偱偡丅
  15. /// </summary>
  16. internal class WarningWithDisableOption : System.Windows.Forms.Form
  17. {
  18. private static Icon _warningIcon;
  19. private System.Windows.Forms.Button _okButton;
  20. private System.Windows.Forms.Label _messageLabel;
  21. private CheckBox _disableCheckBox;
  22. /// <summary>
  23. /// 昁梫側僨僓僀僫曄悢偱偡丅
  24. /// </summary>
  25. private System.ComponentModel.Container components = null;
  26. public WarningWithDisableOption(string message)
  27. {
  28. //
  29. // Windows 僼僅乕儉 僨僓僀僫 僒億乕僩偵昁梫偱偡丅
  30. //
  31. InitializeComponent();
  32. //
  33. // TODO: InitializeComponent 屇傃弌偟偺屻偵丄僐儞僗僩儔僋僞 僐乕僪傪捛壛偟偰偔偩偝偄丅
  34. //
  35. _messageLabel.Text = message;
  36. this.Text = GEnv.Strings.GetString("Form.WarningWithDisableOption.Text");
  37. this._disableCheckBox.Text = GEnv.Strings.GetString("Form.WarningWithDisableOption._disableCheckBox");
  38. }
  39. /// <summary>
  40. /// 巊梡偝傟偰偄傞儕僜乕僗偵屻張棟傪幚峴偟傑偡丅
  41. /// </summary>
  42. protected override void Dispose( bool disposing )
  43. {
  44. if( disposing )
  45. {
  46. if(components != null)
  47. {
  48. components.Dispose();
  49. }
  50. }
  51. base.Dispose( disposing );
  52. }
  53. #region Windows Form Designer generated code
  54. /// <summary>
  55. /// 僨僓僀僫 僒億乕僩偵昁梫側儊僜僢僪偱偡丅偙偺儊僜僢僪偺撪梕傪
  56. /// 僐乕僪 僄僨傿僞偱曄峏偟側偄偱偔偩偝偄丅
  57. /// </summary>
  58. private void InitializeComponent()
  59. {
  60. this._okButton = new System.Windows.Forms.Button();
  61. this._messageLabel = new System.Windows.Forms.Label();
  62. this._disableCheckBox = new CheckBox();
  63. this.SuspendLayout();
  64. // 
  65. // _okButton
  66. // 
  67. this._okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
  68. this._okButton.Location = new System.Drawing.Point(120, 72);
  69. this._okButton.Name = "_okButton";
  70. this._okButton.TabIndex = 0;
  71. this._okButton.FlatStyle = FlatStyle.System;
  72. this._okButton.Text = "OK";
  73. // 
  74. // _messageLabel
  75. // 
  76. this._messageLabel.Location = new System.Drawing.Point(56, 8);
  77. this._messageLabel.Name = "_messageLabel";
  78. this._messageLabel.Size = new System.Drawing.Size(248, 40);
  79. this._messageLabel.TabIndex = 1;
  80. this._messageLabel.Text = "a";
  81. this._messageLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
  82. // 
  83. // _disableCheckBox
  84. // 
  85. this._disableCheckBox.Location = new System.Drawing.Point(56, 48);
  86. this._disableCheckBox.Name = "_disableCheckBox";
  87. this._disableCheckBox.Size = new System.Drawing.Size(248, 24);
  88. this._disableCheckBox.TabIndex = 2;
  89. this._disableCheckBox.FlatStyle = FlatStyle.System;
  90. // 
  91. // WarningWithDisableOption
  92. // 
  93. this.AcceptButton = this._okButton;
  94. this.AutoScaleBaseSize = new System.Drawing.Size(5, 12);
  95. this.ClientSize = new System.Drawing.Size(314, 103);
  96. this.Controls.AddRange(new System.Windows.Forms.Control[] {
  97.   this._disableCheckBox,
  98.   this._messageLabel,
  99.   this._okButton});
  100. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
  101. this.MaximizeBox = false;
  102. this.MinimizeBox = false;
  103. this.Name = "WarningWithDisableOption";
  104. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
  105. this.ShowInTaskbar = false;
  106. this.ResumeLayout(false);
  107. }
  108. #endregion
  109. protected override void OnPaint(PaintEventArgs a) {
  110. base.OnPaint(a);
  111. //傾僀僐儞偺昤夋丂.NET Framework偩偗偱僔僗僥儉偱帩偭偰偄傞傾僀僐儞偺儘乕僪偼偱偒側偄傛偆偩
  112. if(_warningIcon==null) LoadWarningIcon();
  113. a.Graphics.DrawIcon(_warningIcon, 12, 24); 
  114. }
  115. public bool CheckedDisableOption {
  116. get {
  117. return _disableCheckBox.Checked;
  118. }
  119. }
  120. private static void LoadWarningIcon() {
  121. IntPtr hIcon = Win32.LoadIcon(IntPtr.Zero, new IntPtr(Win32.IDI_EXCLAMATION));
  122. _warningIcon = Icon.FromHandle(hIcon);
  123. }
  124. }
  125. }