using O2S.Components.PDFView4NET; using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Lskj.PubPdfSign.Controls { /// /// 签名box对象 /// public class SignBox { public SignBox(PDFPageView _PageView, PDFPage _Page) { PageView = _PageView; Page = _Page; } /// /// PDF文档控件 /// [Browsable(false)] public PDFPageView PageView { get; set; } /// /// 父图片控件 /// [Browsable(false)] public PictureBox ParentPicBox { get; set; } /// /// 父边框控件 /// [Browsable(false)] public ResizeControl ParentResizeControl { get; set; } /// /// 图片地址 /// [Browsable(false)] public string ParentPicBoxImagePath { get; set; } /// /// 页码 /// /// The page number. [Browsable(false)] public int PageNumber { get; set; } /// /// PDF页面 /// /// The page number. [Browsable(false)] public PDFPage Page { get; set; } /// /// 坐标 /// /// The point. [Browsable(false)] public Point PointObj { get; set; } /// /// 步骤 /// /// The point. [Browsable(false)] public string StepCode { get; set; } /// /// 步骤名字 /// /// The point. [Browsable(false)] public string StepName { get; set; } /// /// 宽度 /// public int PdfImageWidth { get; private set; } /// /// 宽度 /// public int SignWidth { get { return ParentPicBox.Width; } set { ParentPicBox.Width = value; } } /// /// 高度 /// public int PdfImageHeight { get; private set; } /// /// 高度 /// public int SignHeight { get { return ParentPicBox.Height; } set { ParentPicBox.Height = value; } } /// /// 左边距 /// public int AbsoluteX { get; private set; } /// /// 左边距 /// public int SignLeft { get { return ParentPicBox.Left; } set { ParentPicBox.Left = value; } } /// /// 左边距 /// public int AbsoluteY { get; private set; } /// /// 上边距 /// public int SignTop { get { return ParentPicBox.Top; } set { ParentPicBox.Top = value; } } /// /// 是否移动状态 /// [BrowsableAttribute(false)] public bool IsMove { get; set; } /// /// 鼠标点击位置 /// [BrowsableAttribute(false)] public Point MouseDownPoint { get; set; } /// /// 附加文件地址 /// public string pdfAdditionalUrl { get; set; } /// /// 更新位置信息 /// public void UpdateLocation() { float width = (float)Page.Width; if (Page.Rotation == PDFPageRotation.Rotate0Degrees) { PDFPoint pdfpoint = PageView.ConvertScreenPointToPDFPoint(new Point(SignLeft, SignTop)); PDFPoint pdfpoint2 = PageView.ConvertScreenPointToPDFPoint(new Point(SignLeft + SignWidth, SignTop + SignHeight)); AbsoluteX = (int)pdfpoint.X; AbsoluteY = (int)pdfpoint2.Y; PdfImageWidth = (int)(pdfpoint2.X - pdfpoint.X); PdfImageHeight = (int)(pdfpoint.Y - pdfpoint2.Y); } else if (Page.Rotation == PDFPageRotation.Rotate90Degrees) { PDFPoint pdfpoint4 = PageView.ConvertScreenPointToPDFPoint(new Point(SignLeft + SignWidth, SignTop)); PDFPoint pdfpoint5 = PageView.ConvertScreenPointToPDFPoint(new Point(SignLeft, SignTop + SignHeight)); AbsoluteX = (int)pdfpoint5.Y; AbsoluteY = (int)(width - (float)pdfpoint5.X); PdfImageWidth = (int)(pdfpoint4.Y - pdfpoint5.Y); PdfImageHeight = (int)(pdfpoint5.X - pdfpoint4.X); } } } }