⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 passwordform.cs

📁 文件保护 文件保护 文件保护
💻 CS
字号:
//***************************************************************************
//
//         Copyright (c) Microsoft Corporation. All rights reserved.
//
//    This code sample is provided "AS IS" without warranty of any kind.
//
//***************************************************************************
#region Using directives

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;

#endregion

namespace DocumentProtector
{
    /// <summary>
    /// Dialog that can be used to get the
    /// password to protect/unprotect documens with.
    /// </summary>
    partial class PasswordForm : Form
    {
        internal PasswordForm(string password)
        {
            InitializeComponent();

            // Initialize the textboxes to contain the given password.
            Debug.Assert(password != null);
            this.passwordTextbox.Text = password;
            this.confirmPasswordTextbox.Text = password;
        }

        /// <summary>
        /// The user indicated password.
        /// </summary>
        /// <value>Returns the password that the user typed in.</value>
        internal string Password
        {
            get
            {
                Debug.Assert(this.passwordTextbox.Text ==
                    this.confirmPasswordTextbox.Text);
                return this.passwordTextbox.Text;
            }
        }


        /// <summary>
        /// Handles the OK Button Click event.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">EventArgs that contain event data.</param>
        private void okButton_Click(object sender, System.EventArgs e)
        {
            // Ensure that the password was confirmed correctly,
            // otherwise, do not exit the dialog yet.
            if (this.passwordTextbox.Text != this.confirmPasswordTextbox.Text)
            {
                MessageBox.Show(
                    Properties.DocumentProtector.confirmFailed, 
                    this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.DialogResult = DialogResult.None;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -