ThreeButtonMessageBox.cs
上传用户:szltgg
上传日期:2019-05-16
资源大小:604k
文件大小:5k
- /*
- * Copyright (c) 2005 Poderosa Project, All Rights Reserved.
- * $Id: ThreeButtonMessageBox.cs,v 1.2 2005/04/20 08:45:45 okajima Exp $
- */
- using System;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- using Poderosa;
- namespace Poderosa.Forms
- {
- /// <summary>
- /// ThreeButtonMessageBox 偺奣梫偺愢柧偱偡丅
- /// </summary>
- internal class ThreeButtonMessageBox : System.Windows.Forms.Form
- {
- private System.Windows.Forms.Button _button1;
- private System.Windows.Forms.Button _button2;
- private System.Windows.Forms.Button _button3;
- private System.Windows.Forms.Label _message;
- /// <summary>
- /// 昁梫側僨僓僀僫曄悢偱偡丅
- /// </summary>
- private System.ComponentModel.Container components = null;
- public ThreeButtonMessageBox()
- {
- //
- // Windows 僼僅乕儉 僨僓僀僫 僒億乕僩偵昁梫偱偡丅
- //
- InitializeComponent();
- //
- // TODO: InitializeComponent 屇傃弌偟偺屻偵丄僐儞僗僩儔僋僞 僐乕僪傪捛壛偟偰偔偩偝偄丅
- //
- }
- /// <summary>
- /// 巊梡偝傟偰偄傞儕僜乕僗偵屻張棟傪幚峴偟傑偡丅
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
- #region Windows Form Designer generated code
- /// <summary>
- /// 僨僓僀僫 僒億乕僩偵昁梫側儊僜僢僪偱偡丅偙偺儊僜僢僪偺撪梕傪
- /// 僐乕僪 僄僨傿僞偱曄峏偟側偄偱偔偩偝偄丅
- /// </summary>
- private void InitializeComponent()
- {
- this._button1 = new System.Windows.Forms.Button();
- this._button2 = new System.Windows.Forms.Button();
- this._button3 = new System.Windows.Forms.Button();
- this._message = new System.Windows.Forms.Label();
- this.SuspendLayout();
- //
- // _button1
- //
- this._button1.DialogResult = System.Windows.Forms.DialogResult.Yes;
- this._button1.Location = new System.Drawing.Point(8, 56);
- this._button1.Name = "_button1";
- this._button1.FlatStyle = FlatStyle.System;
- this._button1.Size = new System.Drawing.Size(96, 23);
- this._button1.TabIndex = 0;
- //
- // _button2
- //
- this._button2.DialogResult = System.Windows.Forms.DialogResult.No;
- this._button2.Location = new System.Drawing.Point(112, 56);
- this._button2.Name = "_button2";
- this._button2.FlatStyle = FlatStyle.System;
- this._button2.Size = new System.Drawing.Size(96, 23);
- this._button2.TabIndex = 1;
- //
- // _button3
- //
- this._button3.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- this._button3.Location = new System.Drawing.Point(216, 56);
- this._button3.Name = "_button3";
- this._button3.FlatStyle = FlatStyle.System;
- this._button3.Size = new System.Drawing.Size(96, 23);
- this._button3.TabIndex = 2;
- //
- // _message
- //
- this._message.Location = new System.Drawing.Point(64, 8);
- this._message.Name = "_message";
- this._message.Size = new System.Drawing.Size(232, 48);
- this._message.TabIndex = 3;
- this._message.TextAlign = System.Drawing.ContentAlignment.TopLeft;
- //
- // ThreeButtonMessageBox
- //
- this.AcceptButton = this._button1;
- this.AutoScaleBaseSize = new System.Drawing.Size(5, 12);
- this.CancelButton = this._button3;
- this.ClientSize = new System.Drawing.Size(322, 85);
- this.Controls.AddRange(new System.Windows.Forms.Control[] {
- this._message,
- this._button3,
- this._button2,
- this._button1});
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "ThreeButtonMessageBox";
- this.ShowInTaskbar = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.ResumeLayout(false);
- }
- #endregion
- public string YesButtonText {
- get {
- return _button1.Text;
- }
- set {
- _button1.Text = value;
- }
- }
- public string NoButtonText {
- get {
- return _button2.Text;
- }
- set {
- _button2.Text = value;
- }
- }
- public string CancelButtonText {
- get {
- return _button3.Text;
- }
- set {
- _button3.Text = value;
- }
- }
- public string Message {
- get {
- return _message.Text;
- }
- set {
- _message.Text = value;
- }
- }
- protected override void OnPaint(PaintEventArgs a) {
- base.OnPaint(a);
- //傾僀僐儞偺昤夋丂.NET Framework偩偗偱僔僗僥儉偱帩偭偰偄傞傾僀僐儞偺儘乕僪偼偱偒側偄傛偆偩
- if(_questionIcon==null) LoadQuestionIcon();
- a.Graphics.DrawIcon(_questionIcon, 16, 8);
- }
- private static Icon _questionIcon;
- private static void LoadQuestionIcon() {
- IntPtr hIcon = Win32.LoadIcon(IntPtr.Zero, new IntPtr(Win32.IDI_QUESTION));
- _questionIcon = Icon.FromHandle(hIcon);
- }
- }
- }