|
@@ -20,6 +20,7 @@ using System.Windows.Input;
|
|
|
using System.Windows.Media;
|
|
|
using System.Windows.Media.Imaging;
|
|
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
|
|
+using Color = System.Drawing.Color;
|
|
|
using Pen = System.Windows.Media.Pen;
|
|
|
using PixelFormat = System.Windows.Media.PixelFormat;
|
|
|
using Point = System.Windows.Point;
|
|
@@ -33,7 +34,7 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
public partial class FillDigitalSignatureControl : UserControl
|
|
|
{
|
|
|
|
|
|
- private readonly string logoPath = "Logo.png";
|
|
|
+ private readonly string logoPath = "Logo_opa40.png";
|
|
|
private string imagePath = string.Empty;
|
|
|
private string Text = string.Empty;
|
|
|
private Dictionary<string, Border> TabDict { get; set; }
|
|
@@ -49,6 +50,8 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
private string location = string.Empty;
|
|
|
|
|
|
private string reason = string.Empty;
|
|
|
+
|
|
|
+ private float[] textColor = new float[] { 0, 0, 0 };
|
|
|
|
|
|
private string _signaturePath = string.Empty;
|
|
|
public string SignaturePath
|
|
@@ -112,11 +115,9 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
if (tempSignatureConfig.IsDrawLogo)
|
|
|
{
|
|
|
tempSignatureConfig.LogoBitmap = new Bitmap(logoPath);
|
|
|
- //set logoBitmap opacity to 0.4
|
|
|
- tempSignatureConfig.LogoBitmap = SetImageOpacity(tempSignatureConfig.LogoBitmap, 0.4f);
|
|
|
}
|
|
|
tempSignatureConfig.Content = Text;
|
|
|
- tempSignatureConfig.textColor = new float[] { 0, 0, 0 };
|
|
|
+ tempSignatureConfig.textColor = textColor;
|
|
|
tempSignatureConfig.contentColor = new float[] { 0, 0, 0 };
|
|
|
signatureWidget.UpdataApWithSignature(tempSignatureConfig);
|
|
|
|
|
@@ -136,20 +137,6 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private Bitmap SetImageOpacity(Bitmap bitmap, float f)
|
|
|
- {
|
|
|
- Bitmap resultBitmap = new Bitmap(bitmap.Width, bitmap.Height);
|
|
|
- using (Graphics g = Graphics.FromImage(resultBitmap))
|
|
|
- {
|
|
|
- ColorMatrix matrix = new ColorMatrix();
|
|
|
- matrix.Matrix33 = f;
|
|
|
- ImageAttributes attributes = new ImageAttributes();
|
|
|
- attributes.SetColorMatrix(matrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
|
|
|
- g.DrawImage(bitmap, new Rectangle(0, 0, resultBitmap.Width, resultBitmap.Height), 0, 0, bitmap.Width, bitmap.Height, GraphicsUnit.Pixel, attributes);
|
|
|
- }
|
|
|
- return resultBitmap;
|
|
|
- }
|
|
|
-
|
|
|
public static byte[] GetTempSignatureImage(CPDFSignatureWidget signatureWidget, out int width, out int height)
|
|
|
{
|
|
|
CRect rect = signatureWidget.GetRect();
|
|
@@ -209,6 +196,7 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
{
|
|
|
tempSignatureConfig.Text = signatureName;
|
|
|
tempSignatureConfig.ImageBitmap = null;
|
|
|
+ KeyboardPopup.Visibility = Visibility.Visible;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -570,5 +558,53 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
Window parentWindow = Window.GetWindow(sender as DependencyObject);
|
|
|
parentWindow?.Close();
|
|
|
}
|
|
|
+
|
|
|
+ private void TextName_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
+ {
|
|
|
+ if (TextName.SelectedIndex != -1)
|
|
|
+ {
|
|
|
+ KeyboardInPutTextBox.FontFamily = new System.Windows.Media.FontFamily(TextName.SelectionBoxItem.ToString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void TextColorPickerControl_Loaded(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ TextColorPickerControl.SetIsChecked(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void TextColorPickerControl_ColorChanged(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ KeyboardInPutTextBox.Foreground = TextColorPickerControl.Brush;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void KeyboardCancel_Click(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ KeyboardPopup.Visibility = Visibility.Collapsed;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void KeyboardClear_Click(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ KeyboardInPutTextBox.Text = string.Empty;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void KeyboardSave_Click(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ signatureName = KeyboardInPutTextBox.Text;
|
|
|
+ tempSignatureConfig.Text = signatureName;
|
|
|
+ SolidColorBrush solidColorBrush = TextColorPickerControl.Brush as SolidColorBrush;
|
|
|
+ float red = solidColorBrush.Color.R;
|
|
|
+ float green = solidColorBrush.Color.G;
|
|
|
+ float blue = solidColorBrush.Color.B;
|
|
|
+ textColor = new [] { red / 255, green / 255, blue / 255};
|
|
|
+
|
|
|
+ KeyboardPopup.Visibility = Visibility.Collapsed;
|
|
|
+ SetProperty();
|
|
|
+ CreateTempSignature();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void KeyboardPopupClose_Click(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ KeyboardPopup.Visibility = Visibility.Collapsed;
|
|
|
+ }
|
|
|
}
|
|
|
}
|