deliverysignaturestandard.cs

来自「微软的行业应用解决方案示例」· CS 代码 · 共 76 行

CS
76
字号
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using HardwareDistributor.Properties;
using System.Drawing.Imaging;

namespace HardwareDistributor.UI
{
    public partial class DeliverySignatureStandard : DeliverySignatureBase
    {
        #region Constructors

        public DeliverySignatureStandard(Guid orderId, int customerId)
            : base(orderId, customerId)
        {
            InitializeComponent();

            //get localized string for the message
            this.label1.Text = Resources.TypeNameMessage;
        }

        #endregion

        #region EventHandlers

        /// <summary>
        /// Go back to the last state in the delivery wizard
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void menuBack_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        #endregion

        #region DeliverySignatureBase Methods

        /// <summary>
        /// Create image file in specified directory
        /// </summary>
        /// <param name="filePath">absolute full path of the output image file</param>
        /// <param name="imageFormat">Image format (gif, jpeg, etc...)</param>
        protected override void CreateSignatureImageFile(string filePath, ImageFormat imageFormat)
        {
            //Save the signature as a GIF file
            HardwareDistributor.Utilities.Utility.CaptureScreenShot(
                this.SignatureTextbox.Location.X, 
                this.SignatureTextbox.Location.Y,
                this.SignatureTextbox.ClientRectangle.Width, 
                this.SignatureTextbox.ClientRectangle.Height,
                this.CreateGraphics(), 
                filePath, 
                imageFormat);

        }

        /// <summary>
        /// Return status of user signature entry
        /// </summary>
        /// <returns>true if signature has been captured on screen, else false</returns>
        protected override bool SignatureCaptured()
        {
            return (this.SignatureTextbox.Text.Length != 0);
        }

        #endregion
    }
}

⌨️ 快捷键说明

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