Update 20250204

This commit is contained in:
Stefan Hutter
2025-02-04 22:36:20 +01:00
parent 293b615547
commit 00eae8a837
2881 changed files with 1570876 additions and 300 deletions

View File

@@ -0,0 +1,15 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("WinSign")]
[assembly: AssemblyDescription("Windows .NET signature capture control")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("winformsignaturecapture.com")]
[assembly: AssemblyProduct("WinSign")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("winformsignaturecapture.com")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Binary file not shown.

59
WinSign/Sign.Designer.cs generated Normal file
View File

@@ -0,0 +1,59 @@
namespace WinSign
{
partial class Sign
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.tmrRefresh = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
//
// tmrRefresh
//
this.tmrRefresh.Interval = 10;
this.tmrRefresh.Tick += new System.EventHandler(this.tmrRefresh_Tick);
//
// Sign
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Margin = new System.Windows.Forms.Padding(4);
this.Name = "Sign";
this.Size = new System.Drawing.Size(429, 244);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Sign_MouseDown);
this.MouseLeave += new System.EventHandler(this.Sign_MouseLeave);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Sign_MouseMove);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Sign_MouseUp);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Timer tmrRefresh;
}
}

275
WinSign/Sign.cs Normal file
View File

@@ -0,0 +1,275 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Reflection;
namespace WinSign
{
public partial class Sign : UserControl
{
private bool _shouldSign = false;
private BackgroundWorker _bgWorker = new BackgroundWorker();
string _signPointsX = "";
string _signPointsY = "";
public Sign()
{
InitializeComponent();
this.BorderStyle = BorderStyle.FixedSingle;
_bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_bgWorker_RunWorkerCompleted);
_bgWorker.DoWork += new DoWorkEventHandler(_bgWorker_DoWork);
this.DoubleBuffered = true;
}
#region " Properties "
/// <summary>
/// The format to save the signature file
/// </summary>
private ImageFormat _signatureFileFormat = ImageFormat.Bmp;
public ImageFormat FileFormat
{
get { return _signatureFileFormat; }
set { _signatureFileFormat = value; }
}
/// <summary>
/// The format to save the signature file
/// </summary>
private Bitmap _signatureBitmap = null;
public Bitmap SignatureBitmap
{
get { return _signatureBitmap; }
}
/// <summary>
/// Color of the signature Default BLUE
/// </summary>
private Color _penColor = Color.Blue;
public Color PenColor
{
get { return _penColor; }
set { _penColor = value; }
}
/// <summary>
/// Width of the Signature Default 4
/// </summary>
private int _penWidth = 4;
public int PenWidth
{
get { return _penWidth; }
set { _penWidth = value; }
}
/// <summary>
/// Required points for valid sign
/// </summary>
private int _requiredPoints = 20;
public int RequiredPoints
{
get { return _requiredPoints; }
set { _requiredPoints = value; }
}
/// <summary>
/// Background Image (Bitmap) for sign
/// </summary>
private Bitmap _backgroundImageBitmap = null;
public Bitmap BackgroundImageBitmap
{
get { return _backgroundImageBitmap; }
set { _backgroundImageBitmap = value; }
}
/// <summary>
/// Informs if the sign was present
/// </summary>
/// <returns></returns>
public bool IsValid
{
get
{
return (_signPointsX.Replace("|","").Trim().Length >= _requiredPoints);
}
}
#endregion
void _bgWorker_DoWork(object sender, DoWorkEventArgs e)
{
e.Result = GetSignImage();
}
void _bgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
this.BackgroundImage = (e.Result as Bitmap);
this.Refresh();
}
private void AddtoX(string x)
{
_signPointsX = _signPointsX + x;
}
private void AddtoY(string y)
{
_signPointsY = _signPointsY + y;
}
private void Sign_MouseDown(object sender, MouseEventArgs e)
{
_shouldSign = true;
tmrRefresh.Start();
AddtoX(e.X.ToString() + ",");
AddtoY(e.Y.ToString() + ",");
}
private void Sign_MouseLeave(object sender, EventArgs e)
{
_shouldSign = false;
tmrRefresh.Stop();
AddtoX("|");
AddtoY("|");
}
private void Sign_MouseMove(object sender, MouseEventArgs e)
{
if (_shouldSign)
{
AddtoX(e.X.ToString() + ',');
AddtoY(e.Y.ToString() + ',');
}
}
private void GenerateSign()
{
if (!_bgWorker.IsBusy)
{
_bgWorker.RunWorkerAsync();
}
}
public void ClearSignature()
{
_signPointsX = "";
_signPointsY = "";
if (null != this.BackgroundImage)
{
this.BackgroundImage = null;
}
_signatureBitmap = null;
if (_backgroundImageBitmap != null)
{
this.BackgroundImage = _backgroundImageBitmap;
}
this.Refresh();
}
private void Sign_MouseUp(object sender, MouseEventArgs e)
{
_shouldSign = false;
tmrRefresh.Stop();
GenerateSign();
AddtoX("|");
AddtoY("|");
}
private void tmrRefresh_Tick(object sender, EventArgs e)
{
GenerateSign();
}
[Obfuscation(Feature = "virtualization", Exclude = false)]
private Bitmap GetSignImage()
{
string[] arrX = _signPointsX.Split('|');
string[] arrY = _signPointsY.Split('|');
int CurrX = 0;
int CurrY = 0;
Bitmap bmp = null;
if (_backgroundImageBitmap != null)
bmp = (Bitmap)_backgroundImageBitmap.Clone();
else
bmp = new Bitmap(this.Width, this.Height);
Graphics g = null;
try
{
g = Graphics.FromImage(bmp);
g.SmoothingMode = SmoothingMode.AntiAlias;
if (_backgroundImageBitmap == null)
{
if (this.FileFormat != ImageFormat.Png || ((this.BackColor != Color.White)))
{
g.FillRectangle(new SolidBrush(this.BackColor), 0, 0, bmp.Width, bmp.Height);
}
}
Pen pn = new Pen(new SolidBrush(this.PenColor),this.PenWidth);
for (int i = 0; i < arrX.Length; i++)
{
if (arrX[i].Length > 0)
{
string[] innerPointsX = arrX[i].Split(',');
string[] innerPointsY = arrY[i].Split(',');
PointF[] tfArray = new PointF[innerPointsX.Length - 1];
for (int j = 0; j < innerPointsX.Length - 1; j++)
{
if (innerPointsX[j].Length > 0)
{
CurrX = Convert.ToInt32(innerPointsX[j]);
CurrY = Convert.ToInt32(innerPointsY[j]);
PointF tf = new PointF(CurrX, CurrY);
tfArray[j] = tf;
}
}
GraphicsPath path = new GraphicsPath();
path.AddLines(tfArray);
g.DrawPath(pn, path);
}
}
}
catch (Exception ex)
{
string err = ex.Message.ToString();
this.ClearSignature();
}
finally
{
if (null != g)
g.Dispose();
}
_signatureBitmap = bmp;
return bmp;
}
}
}

123
WinSign/Sign.resx Normal file
View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="tmrRefresh.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

112
WinSign/WinSign.csproj Normal file
View File

@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{42AEA21A-A537-4B95-AB80-FAC960A8EE16}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WinSign</RootNamespace>
<AssemblyName>WinSign</AssemblyName>
<SignAssembly>false</SignAssembly>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
<UpgradeBackupLocation />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Sign.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Sign.Designer.cs">
<DependentUpon>Sign.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Sign.resx">
<SubType>Designer</SubType>
<DependentUpon>Sign.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishUrlHistory />
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>en-US</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
</Project>

20
WinSign/WinSign.sln Normal file
View File

@@ -0,0 +1,20 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinSign", "WinSign.csproj", "{42AEA21A-A537-4B95-AB80-FAC960A8EE16}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{42AEA21A-A537-4B95-AB80-FAC960A8EE16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{42AEA21A-A537-4B95-AB80-FAC960A8EE16}.Debug|Any CPU.Build.0 = Debug|Any CPU
{42AEA21A-A537-4B95-AB80-FAC960A8EE16}.Release|Any CPU.ActiveCfg = Release|Any CPU
{42AEA21A-A537-4B95-AB80-FAC960A8EE16}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1 @@
b77abc459257f35367c333bd9e280a84bf572dcf05b4d1a8a028aaa32f767bf6

View File

@@ -0,0 +1,8 @@
E:\Software-Projekte\OnDoc\OnDoc\WinSign\bin\Debug\WinSign.dll
E:\Software-Projekte\OnDoc\OnDoc\WinSign\bin\Debug\WinSign.pdb
E:\Software-Projekte\OnDoc\OnDoc\WinSign\obj\Debug\WinSign.csproj.AssemblyReference.cache
E:\Software-Projekte\OnDoc\OnDoc\WinSign\obj\Debug\WinSign.Sign.resources
E:\Software-Projekte\OnDoc\OnDoc\WinSign\obj\Debug\WinSign.csproj.GenerateResource.cache
E:\Software-Projekte\OnDoc\OnDoc\WinSign\obj\Debug\WinSign.csproj.CoreCompileInputs.cache
E:\Software-Projekte\OnDoc\OnDoc\WinSign\obj\Debug\WinSign.dll
E:\Software-Projekte\OnDoc\OnDoc\WinSign\obj\Debug\WinSign.pdb

Binary file not shown.

Binary file not shown.