Files
lserp_cs_6.0/插件库/Lskj.PubPdfSign/Controls/SignBox.cs
T
cyf ab56a9bcf7 基线 SVN r240
SVN-Revision: r240
2025-02-06 06:46:06 +00:00

186 lines
5.2 KiB
C#

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
{
/// <summary>
/// 签名box对象
/// </summary>
public class SignBox
{
public SignBox(PDFPageView _PageView, PDFPage _Page)
{
PageView = _PageView;
Page = _Page;
}
/// <summary>
/// PDF文档控件
/// </summary>
[Browsable(false)]
public PDFPageView PageView { get; set; }
/// <summary>
/// 父图片控件
/// </summary>
[Browsable(false)]
public PictureBox ParentPicBox { get; set; }
/// <summary>
/// 父边框控件
/// </summary>
[Browsable(false)]
public ResizeControl ParentResizeControl { get; set; }
/// <summary>
/// 图片地址
/// </summary>
[Browsable(false)]
public string ParentPicBoxImagePath { get; set; }
/// <summary>
/// 页码
/// </summary>
/// <value>The page number.</value>
[Browsable(false)]
public int PageNumber { get; set; }
/// <summary>
/// PDF页面
/// </summary>
/// <value>The page number.</value>
[Browsable(false)]
public PDFPage Page { get; set; }
/// <summary>
/// 坐标
/// </summary>
/// <value>The point.</value>
[Browsable(false)]
public Point PointObj { get; set; }
/// <summary>
/// 步骤
/// </summary>
/// <value>The point.</value>
[Browsable(false)]
public string StepCode { get; set; }
/// <summary>
/// 步骤名字
/// </summary>
/// <value>The point.</value>
[Browsable(false)]
public string StepName { get; set; }
/// <summary>
/// 宽度
/// </summary>
public int PdfImageWidth { get; private set; }
/// <summary>
/// 宽度
/// </summary>
public int SignWidth
{
get
{
return ParentPicBox.Width;
}
set
{
ParentPicBox.Width = value;
}
}
/// <summary>
/// 高度
/// </summary>
public int PdfImageHeight { get; private set; }
/// <summary>
/// 高度
/// </summary>
public int SignHeight
{
get
{
return ParentPicBox.Height;
}
set
{
ParentPicBox.Height = value;
}
}
/// <summary>
/// 左边距
/// </summary>
public int AbsoluteX { get; private set; }
/// <summary>
/// 左边距
/// </summary>
public int SignLeft
{
get
{
return ParentPicBox.Left;
}
set
{
ParentPicBox.Left = value;
}
}
/// <summary>
/// 左边距
/// </summary>
public int AbsoluteY { get; private set; }
/// <summary>
/// 上边距
/// </summary>
public int SignTop
{
get
{
return ParentPicBox.Top;
}
set
{
ParentPicBox.Top = value;
}
}
/// <summary>
/// 是否移动状态
/// </summary>
[BrowsableAttribute(false)]
public bool IsMove { get; set; }
/// <summary>
/// 鼠标点击位置
/// </summary>
[BrowsableAttribute(false)]
public Point MouseDownPoint { get; set; }
/// <summary>
/// 附加文件地址
/// </summary>
public string pdfAdditionalUrl { get; set; }
/// <summary>
/// 更新位置信息
/// </summary>
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);
}
}
}
}