初始化上传
This commit is contained in:
26
常用工具集/Views/03图片相关/GIF分割.axaml
Normal file
26
常用工具集/Views/03图片相关/GIF分割.axaml
Normal file
@@ -0,0 +1,26 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
mc:Ignorable="d" d:DesignHeight="600" d:DesignWidth="715"
|
||||
xmlns:vm ="clr-namespace:常用工具集.ViewModel._03图片相关"
|
||||
x:Class="常用工具集.GIF分割"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="vm:GIF分割ViewModel">
|
||||
<UserControl.DataContext>
|
||||
<vm:GIF分割ViewModel />
|
||||
</UserControl.DataContext>
|
||||
<Grid>
|
||||
<TextBlock Text="GIF路径:" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="20,26,0,0" />
|
||||
<TextBox HorizontalAlignment="Left" Margin="100,20,0,0" TextWrapping="Wrap" Text="{Binding Path1}" VerticalAlignment="Top" Width="400" />
|
||||
|
||||
<TextBlock Text="导出目录:" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="20,82,0,0" />
|
||||
<TextBox HorizontalAlignment="Left" Margin="100,76,0,0" TextWrapping="Wrap" Text="{Binding Path2}" VerticalAlignment="Top" Width="400" />
|
||||
|
||||
<Button Content="浏览..." Command="{Binding SelectGifCmd}" HorizontalAlignment="Left" Margin="530,20,0,0" VerticalAlignment="Top" />
|
||||
<Button Content="浏览..." Command="{Binding SelectExportPathCmd}" HorizontalAlignment="Left" Margin="530,76,0,0" VerticalAlignment="Top" />
|
||||
<Button Content="{Binding ButtonName}" Command="{Binding ExportCmd}" HorizontalAlignment="Left" Margin="20,135,0,0" VerticalAlignment="Top" Width="565" />
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
13
常用工具集/Views/03图片相关/GIF分割.axaml.cs
Normal file
13
常用工具集/Views/03图片相关/GIF分割.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace 常用工具集;
|
||||
|
||||
public partial class GIF分割 : UserControl
|
||||
{
|
||||
public GIF分割()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
37
常用工具集/Views/03图片相关/二维码条形码生成.axaml
Normal file
37
常用工具集/Views/03图片相关/二维码条形码生成.axaml
Normal file
@@ -0,0 +1,37 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
xmlns:vm ="clr-namespace:常用工具集.ViewModel._03图片相关"
|
||||
x:Class="常用工具集.二维码条形码生成" KeyDown="UserControl_KeyDown" >
|
||||
<!--<UserControl.DataContext>
|
||||
<vm:二维码条形码生成ViewModel />
|
||||
</UserControl.DataContext>-->
|
||||
<Grid>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="65,10,0,0" TextWrapping="Wrap" Text="输入完按回车键可以直接生成,按ctrl+s可以保存,ctrl+c可以复制到剪切板" Foreground="Red" VerticalAlignment="Top" Width="450" Height="25" />
|
||||
<TextBlock HorizontalAlignment="Left" Margin="34,46,0,0" TextWrapping="Wrap" Text="内容"/>
|
||||
|
||||
<TextBox x:Name="txtContent" KeyDown="TextBox_KeyDown" HorizontalAlignment="Left" Margin="85,40,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="273" Height="25" >
|
||||
<!--以下为CTRL+C功能-->
|
||||
<!--<TextBox.CommandBindings>
|
||||
<CommandBinding Command="Copy" Executed="btnCopy_Click"/>
|
||||
</TextBox.CommandBindings>
|
||||
<TextBox.InputBindings>
|
||||
<KeyBinding Key="C" Modifiers="Control" Command="Copy" />
|
||||
</TextBox.InputBindings>-->
|
||||
<!--以上为CTRL+C功能-->
|
||||
|
||||
</TextBox>
|
||||
<Button x:Name="btnGenerate" Click="btnGenerate_Click" Content="生成" HorizontalAlignment="Left" Margin="395,40,0,0" VerticalAlignment="Top" Width="75" />
|
||||
<Button x:Name="btnSave" Content="保存" HorizontalAlignment="Left" Margin="475,40,0,0" VerticalAlignment="Top" Width="75" Click="btnSave_Click" />
|
||||
<Button x:Name="btnSaveSVG" Content="保存SVG" HorizontalAlignment="Left" Margin="555,40,0,0" VerticalAlignment="Top" Width="90" Click="btnSaveSVG_Click" />
|
||||
<RadioButton x:Name="rdChecked1" Content="QRCode" IsChecked="True" HorizontalAlignment="Left" Margin="35,89,0,0" VerticalAlignment="Top"/>
|
||||
<RadioButton x:Name="rdChecked2" Content="DataMatrix(12*12)" IsChecked="False" HorizontalAlignment="Left" Margin="162,89,0,0" VerticalAlignment="Top"/>
|
||||
<RadioButton x:Name="rdChecked3" Content="DataMatrix(16*16)" IsChecked="False" HorizontalAlignment="Left" Margin="343,89,0,0" VerticalAlignment="Top"/>
|
||||
<RadioButton x:Name="rdChecked4" Content="Code39" IsChecked="False" HorizontalAlignment="Left" Margin="35,125,0,0" VerticalAlignment="Top"/>
|
||||
<RadioButton x:Name="rdChecked5" Content="Code128" IsChecked="False" HorizontalAlignment="Left" Margin="159,128,0,0" VerticalAlignment="Top"/>
|
||||
<Image x:Name="image1" HorizontalAlignment="Left" Height="350" Margin="159,175,0,0" VerticalAlignment="Top" Width="350" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
176
常用工具集/Views/03图片相关/二维码条形码生成.axaml.cs
Normal file
176
常用工具集/Views/03图片相关/二维码条形码生成.axaml.cs
Normal file
@@ -0,0 +1,176 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Platform.Storage;
|
||||
using MES.Utility.Core;
|
||||
using SkiaSharp;
|
||||
using Ursa.Controls;
|
||||
using ZXing;
|
||||
using 常用工具集.Base;
|
||||
using 常用工具集.Utility.Qrcode;
|
||||
|
||||
namespace 常用工具集;
|
||||
|
||||
public partial class 二维码条形码生成 : UserControl
|
||||
{
|
||||
private SKBitmap Image;
|
||||
private string svg;
|
||||
public 二维码条形码生成()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private Bitmap BitmapToBitmapImage(SKBitmap skBitmap)
|
||||
{
|
||||
byte[] bytes = null;
|
||||
using (MemoryStream stream = new MemoryStream())
|
||||
{
|
||||
skBitmap.Encode(SKEncodedImageFormat.Png, 100).SaveTo(stream);
|
||||
bytes = stream.ToArray();
|
||||
}
|
||||
using (MemoryStream stream = new MemoryStream(bytes))
|
||||
{
|
||||
return new Bitmap(stream);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnGenerate_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (txtContent.Text.IsNullOrEmpty())
|
||||
{
|
||||
MessageBox.ShowAsync("请输入内容");
|
||||
return;
|
||||
}
|
||||
if (rdChecked1.IsChecked.Value)
|
||||
{
|
||||
SKBitmap image = QRCodeUtils.EncodeQrCode(txtContent.Text, 900, out svg);
|
||||
Image = image;
|
||||
image1.Source = BitmapToBitmapImage(image);
|
||||
}
|
||||
else if (rdChecked2.IsChecked.Value)
|
||||
{
|
||||
SKBitmap image = DataMatrixUtils.EncodeDataMatrix(DmtxSymbolSize.DmtxSymbol12x12, txtContent.Text, 900, out svg);
|
||||
Image = image;
|
||||
image1.Source = BitmapToBitmapImage(image);
|
||||
}
|
||||
else if (rdChecked3.IsChecked.Value)
|
||||
{
|
||||
SKBitmap image = DataMatrixUtils.EncodeDataMatrix(DmtxSymbolSize.DmtxSymbol16x16, txtContent.Text, 900, out svg);
|
||||
Image = image;
|
||||
image1.Source = BitmapToBitmapImage(image);
|
||||
}
|
||||
else if (rdChecked4.IsChecked.Value)
|
||||
{
|
||||
SKBitmap image = BarCodeUtils.EncodeBarCode(BarcodeFormat.CODE_39, txtContent.Text, 900, 500, out svg);
|
||||
Image = image;
|
||||
image1.Source = BitmapToBitmapImage(image);
|
||||
}
|
||||
else if (rdChecked5.IsChecked.Value)
|
||||
{
|
||||
SKBitmap image = BarCodeUtils.EncodeBarCode(BarcodeFormat.CODE_128, txtContent.Text, 900, 500, out svg);
|
||||
Image = image;
|
||||
image1.Source = BitmapToBitmapImage(image);
|
||||
}
|
||||
}
|
||||
private async void btnSave_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (Image == null)
|
||||
return;
|
||||
|
||||
var sp = GlobalValues.StorageProvider;
|
||||
if (sp is null) return;
|
||||
var result = await sp.SaveFilePickerAsync(new FilePickerSaveOptions()
|
||||
{
|
||||
Title = "保存图像",
|
||||
DefaultExtension = "png"
|
||||
});
|
||||
if (result == null) return;
|
||||
string temp = result.Path.LocalPath;
|
||||
Save(temp, Image);
|
||||
}
|
||||
|
||||
private void Save(string path, SKBitmap bitmap)
|
||||
{
|
||||
using (var stream = File.OpenWrite(path))
|
||||
{
|
||||
bitmap.Encode(SKEncodedImageFormat.Png, 100).SaveTo(stream);
|
||||
}
|
||||
}
|
||||
private async void btnSaveSVG_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (Image == null)
|
||||
return;
|
||||
var sp = GlobalValues.StorageProvider;
|
||||
if (sp is null) return;
|
||||
var result = await sp.SaveFilePickerAsync(new FilePickerSaveOptions()
|
||||
{
|
||||
Title = "保存SVG",
|
||||
DefaultExtension = "svg"
|
||||
});
|
||||
if (result == null) return;
|
||||
string temp = result.Path.LocalPath;
|
||||
System.IO.File.WriteAllText(temp, svg, Encoding.UTF8);
|
||||
}
|
||||
|
||||
private void TextBox_KeyDown(object? sender, Avalonia.Input.KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyModifiers == Avalonia.Input.KeyModifiers.Control)
|
||||
{
|
||||
e.Handled = true;
|
||||
if (e.Key == Key.LeftCtrl || e.Key == Key.RightCtrl)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.Key == Key.V)
|
||||
{
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
btnGenerate_Click(sender, e);
|
||||
}
|
||||
else if (e.KeyModifiers == KeyModifiers.Control && e.Key == Key.S)
|
||||
{
|
||||
e.Handled = true;
|
||||
btnSave_Click(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void UserControl_KeyDown(object? sender, Avalonia.Input.KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
btnGenerate_Click(sender, e);
|
||||
}
|
||||
else if (e.KeyModifiers == KeyModifiers.Control && e.Key == Key.C)
|
||||
{
|
||||
e.Handled = true;
|
||||
if (Image == null)
|
||||
return;
|
||||
byte[] bytes = null;
|
||||
using (MemoryStream stream = new MemoryStream())
|
||||
{
|
||||
Image.Encode(SKEncodedImageFormat.Png, 100).SaveTo(stream);
|
||||
bytes = stream.ToArray();
|
||||
}
|
||||
DataObject clipboardData = new DataObject();
|
||||
clipboardData.Set(DataFormats.Files, BitmapToBitmapImage(Image));
|
||||
GlobalValues.Clipboard.SetDataObjectAsync(clipboardData);
|
||||
}
|
||||
else if (e.KeyModifiers == KeyModifiers.Control && e.Key == Key.S)
|
||||
{
|
||||
e.Handled = true;
|
||||
btnSave_Click(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
22
常用工具集/Views/03图片相关/二维码条形码解析.axaml
Normal file
22
常用工具集/Views/03图片相关/二维码条形码解析.axaml
Normal file
@@ -0,0 +1,22 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="clr-namespace:常用工具集.ViewModel._03图片相关"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="常用工具集.二维码条形码解析"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="vm:二维码条形码解析ViewModel">
|
||||
<UserControl.DataContext>
|
||||
<vm:二维码条形码解析ViewModel/>
|
||||
</UserControl.DataContext>
|
||||
<Grid>
|
||||
<TextBlock Text="图片文件:" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="30,33,0,0" />
|
||||
<TextBox Text="{Binding ImagePath}" Height="30" HorizontalAlignment="Left" Margin="110,27,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="275" />
|
||||
<Button Content="选择" Command="{Binding SelectPathCmd}" HorizontalAlignment="Left" Margin="390,27,0,0" VerticalAlignment="Top" Width="76" />
|
||||
<Button Content="解析" Command="{Binding GetResultCmd}" HorizontalAlignment="Left" Margin="150,72,0,0" VerticalAlignment="Top" Width="76" />
|
||||
|
||||
<TextBlock Text="结果:" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="50,136,0,0" />
|
||||
<TextBox Text="{Binding Result}" Height="200" HorizontalContentAlignment="Left" VerticalContentAlignment="Top" HorizontalAlignment="Left" Margin="130,130,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="255" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
13
常用工具集/Views/03图片相关/二维码条形码解析.axaml.cs
Normal file
13
常用工具集/Views/03图片相关/二维码条形码解析.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace 常用工具集;
|
||||
|
||||
public partial class 二维码条形码解析 : UserControl
|
||||
{
|
||||
public 二维码条形码解析()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
24
常用工具集/Views/03图片相关/图片转ICO.axaml
Normal file
24
常用工具集/Views/03图片相关/图片转ICO.axaml
Normal file
@@ -0,0 +1,24 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
xmlns:vm ="clr-namespace:常用工具集.ViewModel._03图片相关"
|
||||
x:Class="常用工具集.图片转ICO"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="vm:图片转ICOViewModel">
|
||||
<UserControl.DataContext>
|
||||
<vm:图片转ICOViewModel />
|
||||
</UserControl.DataContext>
|
||||
<Grid>
|
||||
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Text="请选择图片:" Margin="40,56,0,0" />
|
||||
<TextBox HorizontalAlignment="Left" Margin="120,50,0,0" TextWrapping="Wrap" Text="{Binding ImagePath}" VerticalAlignment="Top" Width="420" />
|
||||
<Button Content="选择图片" Command="{Binding SelectImageCmd}" HorizontalAlignment="Left" Margin="550,50,0,0" VerticalAlignment="Top" />
|
||||
<Image Source="{Binding ImageSource}" HorizontalAlignment="Left" Height="350" Margin="140,83,0,0" VerticalAlignment="Top" Width="350" />
|
||||
<Button Content="16*16" Width="80" Command="{Binding ExportCmd}" CommandParameter="16" HorizontalAlignment="Left" Margin="40,455,0,0" VerticalAlignment="Top" />
|
||||
<Button Content="32*32" Width="80" Command="{Binding ExportCmd}" CommandParameter="32" HorizontalAlignment="Left" Margin="150,455,0,0" VerticalAlignment="Top" />
|
||||
<Button Content="64*64" Width="80" Command="{Binding ExportCmd}" CommandParameter="64" HorizontalAlignment="Left" Margin="262,455,0,0" VerticalAlignment="Top" />
|
||||
<Button Content="128*128" Width="80" Command="{Binding ExportCmd}" CommandParameter="128" HorizontalAlignment="Left" Margin="375,455,0,0" VerticalAlignment="Top" />
|
||||
<Button Content="255*255" Width="80" Command="{Binding ExportCmd}" CommandParameter="255" HorizontalAlignment="Left" Margin="495,455,0,0" VerticalAlignment="Top" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
13
常用工具集/Views/03图片相关/图片转ICO.axaml.cs
Normal file
13
常用工具集/Views/03图片相关/图片转ICO.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace 常用工具集;
|
||||
|
||||
public partial class 图片转ICO : UserControl
|
||||
{
|
||||
public 图片转ICO()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
25
常用工具集/Views/03图片相关/导航二维码生成.axaml
Normal file
25
常用工具集/Views/03图片相关/导航二维码生成.axaml
Normal file
@@ -0,0 +1,25 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignHeight="660" d:DesignWidth="715"
|
||||
x:Class="常用工具集.导航二维码生成">
|
||||
<Grid>
|
||||
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Text="二维码值:" Margin="10,16,0,0" />
|
||||
<TextBox Name="textBox1" HorizontalAlignment="Left" Margin="75,10,0,0" TextWrapping="Wrap" Text="2" VerticalAlignment="Top" Width="35" />
|
||||
<Button Name="button1" Click="button1_Click" Content="单个生成" HorizontalAlignment="Left" Margin="135,10,0,0" VerticalAlignment="Top" />
|
||||
<TextBox Name="textBox2" HorizontalAlignment="Left" Margin="230,10,0,0" TextWrapping="Wrap" Text="1" VerticalAlignment="Top" Width="45" />
|
||||
<TextBlock HorizontalAlignment="Left" Margin="275,16,0,0" TextWrapping="Wrap" Text="~" VerticalAlignment="Top" Width="10" />
|
||||
<TextBox Name="textBox3" HorizontalAlignment="Left" Margin="290,10,0,0" TextWrapping="Wrap" Text="255" VerticalAlignment="Top" Width="45" />
|
||||
<Button Name="button2" Click="button2_Click" Content="批量生成" HorizontalAlignment="Left" Margin="335,10,0,0" VerticalAlignment="Top" />
|
||||
<CheckBox Name="uiCheckBox1" IsChecked="True" Content="A4" Margin="410,14,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Height="25" />
|
||||
<RadioButton Name="uiRadioButton1" Height="20" Content="倍加福" IsChecked="True" HorizontalAlignment="Left" Margin="60,55,0,0" VerticalAlignment="Top"/>
|
||||
<RadioButton Name="uiRadioButton2" Height="20" Content="大华" IsChecked="False" HorizontalAlignment="Left" Margin="147,55,0,0" VerticalAlignment="Top"/>
|
||||
|
||||
<TextBlock HorizontalAlignment="Left" Margin="275,58,0,0" TextWrapping="Wrap" Text="线程数" VerticalAlignment="Top" Width="45" />
|
||||
<NumericUpDown Name="threadCountUpDown" Increment="1" Value="5" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="320,51,0,0" Width="115" Maximum="10" Minimum="1" />
|
||||
|
||||
|
||||
<Image x:Name="pictureBox1" HorizontalAlignment="Left" Height="350" Margin="35,110,0,0" VerticalAlignment="Top" Width="350" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
940
常用工具集/Views/03图片相关/导航二维码生成.axaml.cs
Normal file
940
常用工具集/Views/03图片相关/导航二维码生成.axaml.cs
Normal file
@@ -0,0 +1,940 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Shapes;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Platform;
|
||||
using Avalonia.Platform.Storage;
|
||||
using Avalonia.Threading;
|
||||
using SkiaSharp;
|
||||
using Ursa.Controls;
|
||||
using 常用工具集.Base;
|
||||
using 常用工具集.Utility.Qrcode;
|
||||
|
||||
namespace 常用工具集
|
||||
{
|
||||
public partial class 导航二维码生成 : UserControl
|
||||
{
|
||||
private static int every = 16;
|
||||
private object _obj = new object();
|
||||
private bool flag;
|
||||
private int totalCount;
|
||||
private Queue<string> qrcodeList;
|
||||
SKBitmap background;
|
||||
SKBitmap left;
|
||||
SKBitmap down;
|
||||
|
||||
public 导航二维码生成()
|
||||
{
|
||||
InitializeComponent();
|
||||
background = GetResource("background");
|
||||
left = GetResource("left");
|
||||
down = GetResource("down");
|
||||
}
|
||||
private SKBitmap GetResource(string name)
|
||||
{
|
||||
// 获取Pack URI
|
||||
string packUri = $"avares://常用工具集/Assets/Navi/{name}.png";
|
||||
Stream stream = AssetLoader.Open(new Uri(packUri));
|
||||
return SKBitmap.Decode(stream);
|
||||
}
|
||||
|
||||
private async void button1_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string text = this.textBox1.Text.Trim();
|
||||
int num;
|
||||
bool flag = int.TryParse(text, out num);
|
||||
SKBitmap bitmap = null;
|
||||
if (!flag)
|
||||
{
|
||||
await MessageBox.ShowAsync("请输入数字");
|
||||
return;
|
||||
}
|
||||
if (uiRadioButton1.IsChecked.Value)
|
||||
{
|
||||
if (num < 0 || num > 99999999)
|
||||
{
|
||||
await MessageBox.ShowAsync("数据只能在0~99999999之间");
|
||||
return;
|
||||
}
|
||||
bitmap = this.GetBeiJiaFuDataMatrixImage2(num.ToString().PadLeft(8, '0'));
|
||||
}
|
||||
if (uiRadioButton2.IsChecked.Value)
|
||||
{
|
||||
if (num < 0 || num > 9999999)
|
||||
{
|
||||
MessageBox.ShowAsync("数据只能在0~9999999之间");
|
||||
return;
|
||||
}
|
||||
bitmap = this.GetHaiKangDataMatrixImage2(num.ToString().PadLeft(7, '0'));
|
||||
}
|
||||
if (bitmap == null)
|
||||
{
|
||||
GlobalValues.Error("生成失败");
|
||||
return;
|
||||
}
|
||||
this.pictureBox1.Source = BitmapToBitmapImage(bitmap);
|
||||
|
||||
var sp = GlobalValues.StorageProvider;
|
||||
if (sp is null) return;
|
||||
var result = await sp.OpenFolderPickerAsync(new FolderPickerOpenOptions()
|
||||
{
|
||||
Title = "请选择要生成的目录",
|
||||
AllowMultiple = false,
|
||||
});
|
||||
if (result == null || result.Count == 0)
|
||||
{
|
||||
await MessageBox.ShowAsync("文件夹路径不能为空");
|
||||
return;
|
||||
}
|
||||
string str2 = result.FirstOrDefault()?.Path.LocalPath;
|
||||
if (!str2.EndsWith("/"))
|
||||
{
|
||||
str2 += "/";
|
||||
}
|
||||
string path = str2 + text + ".png";
|
||||
if (File.Exists(path))
|
||||
{
|
||||
File.Delete(path);
|
||||
}
|
||||
Save(path, bitmap);
|
||||
GlobalValues.Success("保存成功");
|
||||
}
|
||||
|
||||
private Bitmap BitmapToBitmapImage(SKBitmap skBitmap)
|
||||
{
|
||||
byte[] bytes = null;
|
||||
using (MemoryStream stream = new MemoryStream())
|
||||
{
|
||||
skBitmap.Encode(SKEncodedImageFormat.Png, 100).SaveTo(stream);
|
||||
bytes = stream.ToArray();
|
||||
}
|
||||
using (MemoryStream stream = new MemoryStream(bytes))
|
||||
{
|
||||
return new Bitmap(stream);
|
||||
}
|
||||
}
|
||||
|
||||
private async void button2_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (uiRadioButton1.IsChecked.Value)
|
||||
{
|
||||
if (button2.Content.ToString() == "批量生成")
|
||||
{
|
||||
int start = 0;
|
||||
int end = 0;
|
||||
if (!CheckBeiJiaFuNum(ref start, ref end))
|
||||
{
|
||||
return;
|
||||
}
|
||||
//提示
|
||||
var sp = GlobalValues.StorageProvider;
|
||||
if (sp is null) return;
|
||||
var result = await sp.OpenFolderPickerAsync(new FolderPickerOpenOptions()
|
||||
{
|
||||
Title = "请选择要生成的目录",
|
||||
AllowMultiple = false,
|
||||
});
|
||||
if (result == null || result.Count == 0)
|
||||
{
|
||||
await MessageBox.ShowAsync("文件夹路径不能为空");
|
||||
return;
|
||||
}
|
||||
string str = result.FirstOrDefault()?.Path.LocalPath;
|
||||
if (!str.EndsWith("/"))
|
||||
{
|
||||
str = str + "/";
|
||||
}
|
||||
flag = true;
|
||||
//开始生成线程
|
||||
GlobalValues.Warning("正在执行保存操作,这将会比较耗时,请稍等");
|
||||
GenerateObject obj = new GenerateObject { StartNum = start, EndNum = end, ThreadCount = (int)threadCountUpDown.Value, SavePath = str, IsA4 = uiCheckBox1.IsChecked.Value };
|
||||
new Thread(GenerateBeiJiaFuFunc).Start(obj);
|
||||
button2.Content = "停止生成";
|
||||
}
|
||||
else
|
||||
{
|
||||
flag = false;
|
||||
button2.Content = "批量生成";
|
||||
if (qrcodeList != null)
|
||||
qrcodeList.Clear();
|
||||
}
|
||||
|
||||
}
|
||||
if (uiRadioButton2.IsChecked.Value)
|
||||
{
|
||||
if (button2.Content.ToString() == "批量生成")
|
||||
{
|
||||
int start = 0;
|
||||
int end = 0;
|
||||
if (!CheckHaiKangNum(ref start, ref end))
|
||||
{
|
||||
return;
|
||||
}
|
||||
//提示
|
||||
var sp = GlobalValues.StorageProvider;
|
||||
if (sp is null) return;
|
||||
var result = await sp.OpenFolderPickerAsync(new FolderPickerOpenOptions()
|
||||
{
|
||||
Title = "请选择要生成的目录",
|
||||
AllowMultiple = false,
|
||||
});
|
||||
if (result == null || result.Count == 0)
|
||||
{
|
||||
await MessageBox.ShowAsync("文件夹路径不能为空");
|
||||
return;
|
||||
}
|
||||
string str = result.FirstOrDefault()?.Path.LocalPath;
|
||||
if (!str.EndsWith("/"))
|
||||
{
|
||||
str = str + "/";
|
||||
}
|
||||
flag = true;
|
||||
//开始生成线程
|
||||
GlobalValues.Warning("正在执行保存操作,这将会比较耗时,请稍等");
|
||||
GenerateObject obj = new GenerateObject { StartNum = start, EndNum = end, ThreadCount = (int)threadCountUpDown.Value, SavePath = str, IsA4 = uiCheckBox1.IsChecked.Value };
|
||||
new Thread(GenerateHaiKangFunc).Start(obj);
|
||||
button2.Content = "停止生成";
|
||||
}
|
||||
else
|
||||
{
|
||||
flag = false;
|
||||
button2.Content = "批量生成";
|
||||
if (qrcodeList != null)
|
||||
qrcodeList.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void GenerateHaiKangFunc(object obj)
|
||||
{
|
||||
GenerateObject parm = (GenerateObject)obj;
|
||||
if (qrcodeList == null)
|
||||
qrcodeList = new Queue<string>();
|
||||
qrcodeList.Clear();
|
||||
if (!parm.IsA4)
|
||||
{
|
||||
//普通生成
|
||||
for (int i = parm.StartNum; i <= parm.EndNum; i++)
|
||||
{
|
||||
qrcodeList.Enqueue(i.ToString().PadLeft(7, '0'));
|
||||
}
|
||||
totalCount = qrcodeList.Count;
|
||||
}
|
||||
else
|
||||
{
|
||||
//A4生成
|
||||
//计算组
|
||||
int count = (parm.EndNum - parm.StartNum + 1);
|
||||
int group = 0;
|
||||
if (count % 12 == 0)
|
||||
group = count / 12;
|
||||
else
|
||||
group = count / 12 + 1;
|
||||
|
||||
int num = parm.StartNum;
|
||||
for (int i = 0; i < (group - 1); i++)
|
||||
{
|
||||
int st = num + 12 * i;
|
||||
int ed = num + 12 * i + 11;
|
||||
string str = "";
|
||||
for (int j = st; j <= ed; j++)
|
||||
{
|
||||
str = str + j.ToString().PadLeft(7, '0') + ",";
|
||||
}
|
||||
str = str.Substring(0, str.Length - 1);
|
||||
qrcodeList.Enqueue(str);
|
||||
}
|
||||
//最后一组开始
|
||||
int st1 = num + 12 * (group - 1);
|
||||
int ed1 = parm.EndNum;
|
||||
string str1 = "";
|
||||
for (int j = st1; j <= ed1; j++)
|
||||
{
|
||||
str1 = str1 + j.ToString().PadLeft(7, '0') + ",";
|
||||
}
|
||||
str1 = str1.Substring(0, str1.Length - 1);
|
||||
qrcodeList.Enqueue(str1);
|
||||
totalCount = qrcodeList.Count;
|
||||
}
|
||||
//根据线程数,创建线程
|
||||
for (int i = 0; i < parm.ThreadCount; i++)
|
||||
{
|
||||
Thread thread = new Thread(GenerateOneHaiKangQrCode);
|
||||
thread.Start(parm);
|
||||
}
|
||||
while (true)
|
||||
{
|
||||
if (!flag)
|
||||
{
|
||||
break;
|
||||
}
|
||||
//判断qrcodeList是否为空
|
||||
bool isEmpty = false;
|
||||
lock (_obj)
|
||||
{
|
||||
isEmpty = qrcodeList.Count == 0;
|
||||
}
|
||||
if (isEmpty && totalCount == 0)
|
||||
{
|
||||
Dispatcher.UIThread.Invoke(() =>
|
||||
{
|
||||
GlobalValues.Success("保存成功");
|
||||
});
|
||||
flag = false;
|
||||
Dispatcher.UIThread.Invoke(() =>
|
||||
{
|
||||
button2.Content = "批量生成";
|
||||
});
|
||||
if (qrcodeList != null)
|
||||
qrcodeList.Clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void GenerateOneHaiKangQrCode(object obj)
|
||||
{
|
||||
GenerateObject parm = (GenerateObject)obj;
|
||||
while (flag)
|
||||
{
|
||||
try
|
||||
{
|
||||
//从list中取出一个
|
||||
bool isEmpty;
|
||||
string txt = "";
|
||||
lock (_obj)
|
||||
{
|
||||
isEmpty = qrcodeList.Count == 0;
|
||||
if (!isEmpty)
|
||||
{
|
||||
txt = qrcodeList.Dequeue();
|
||||
}
|
||||
}
|
||||
if (isEmpty)
|
||||
return;
|
||||
List<string> everyQrcode = txt.Split(',').ToList();
|
||||
if (parm.IsA4)
|
||||
{
|
||||
CreateHaiKangA4AndSave(everyQrcode, parm.SavePath);
|
||||
lock (_obj)
|
||||
{
|
||||
totalCount--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string path = parm.SavePath + everyQrcode[0] + ".png";
|
||||
if (File.Exists(path))
|
||||
{
|
||||
File.Delete(path);
|
||||
}
|
||||
SKBitmap bitmap = this.GetHaiKangDataMatrixImage2(everyQrcode[0]);
|
||||
Save(path, bitmap);
|
||||
bitmap.Dispose();
|
||||
bitmap = null;
|
||||
lock (_obj)
|
||||
{
|
||||
totalCount--;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
private void Save(string path, SKBitmap bitmap)
|
||||
{
|
||||
using (var stream = File.OpenWrite(path))
|
||||
{
|
||||
bitmap.Encode(SKEncodedImageFormat.Png, 100).SaveTo(stream);
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckHaiKangNum(ref int start, ref int end)
|
||||
{
|
||||
int startNum = 0;
|
||||
int endNum = 0;
|
||||
try
|
||||
{
|
||||
startNum = Convert.ToInt32(this.textBox2.Text.Trim());
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
MessageBox.ShowAsync("开始数据只能为整数");
|
||||
return false;
|
||||
}
|
||||
try
|
||||
{
|
||||
endNum = Convert.ToInt32(this.textBox3.Text.Trim());
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
MessageBox.ShowAsync("结束数据只能为整数");
|
||||
return false;
|
||||
}
|
||||
if (startNum > 9999999)
|
||||
{
|
||||
MessageBox.ShowAsync("开始数据不能超过9999999");
|
||||
return false;
|
||||
}
|
||||
if (endNum > 9999999)
|
||||
{
|
||||
MessageBox.ShowAsync("结束数据不能超过9999999");
|
||||
return false;
|
||||
}
|
||||
if (startNum > endNum)
|
||||
{
|
||||
MessageBox.ShowAsync("开始数据不能大于结束数据");
|
||||
return false;
|
||||
}
|
||||
start = startNum;
|
||||
end = endNum;
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CreateHaiKangA4AndSave(List<string> everyQrcode, string savaPath)
|
||||
{
|
||||
string path = "";
|
||||
if (everyQrcode.Count == 1)
|
||||
{
|
||||
path = savaPath + everyQrcode[0] + ".png";
|
||||
}
|
||||
else
|
||||
{
|
||||
path = savaPath + Convert.ToInt32(everyQrcode[0]) + "_" + Convert.ToInt32(everyQrcode[everyQrcode.Count - 1]) + ".png";
|
||||
}
|
||||
if (File.Exists(path))
|
||||
{
|
||||
File.Delete(path);
|
||||
}
|
||||
//创建一张A4纸
|
||||
SKBitmap a4 = new SKBitmap(2480, 3508);
|
||||
SKCanvas graphics = new SKCanvas(a4);
|
||||
//循环生成start 到end的单个文件
|
||||
int index = 1;
|
||||
foreach (string text in everyQrcode)
|
||||
{
|
||||
SKBitmap bitmap = this.GetHaiKangDataMatrixImage2(text);
|
||||
if (index == 1)
|
||||
{
|
||||
graphics.DrawBitmap(bitmap, 170 + 730 * 0, 200 + 790 * 0);
|
||||
}
|
||||
else if (index == 2)
|
||||
{
|
||||
graphics.DrawBitmap(bitmap, 170 + 730 * 1, 200 + 790 * 0);
|
||||
}
|
||||
else if (index == 3)
|
||||
{
|
||||
graphics.DrawBitmap(bitmap, 170 + 730 * 2, 200 + 790 * 0);
|
||||
}
|
||||
else if (index == 4)
|
||||
{
|
||||
graphics.DrawBitmap(bitmap, 170 + 730 * 0, 200 + 790 * 1);
|
||||
}
|
||||
else if (index == 5)
|
||||
{
|
||||
graphics.DrawBitmap(bitmap, 170 + 730 * 1, 200 + 790 * 1);
|
||||
}
|
||||
else if (index == 6)
|
||||
{
|
||||
graphics.DrawBitmap(bitmap, 170 + 730 * 2, 200 + 790 * 1);
|
||||
}
|
||||
else if (index == 7)
|
||||
{
|
||||
graphics.DrawBitmap(bitmap, 170 + 730 * 0, 200 + 790 * 2);
|
||||
}
|
||||
else if (index == 8)
|
||||
{
|
||||
graphics.DrawBitmap(bitmap, 170 + 730 * 1, 200 + 790 * 2);
|
||||
}
|
||||
else if (index == 9)
|
||||
{
|
||||
graphics.DrawBitmap(bitmap, 170 + 730 * 2, 200 + 790 * 2);
|
||||
}
|
||||
else if (index == 10)
|
||||
{
|
||||
graphics.DrawBitmap(bitmap, 170 + 730 * 0, 200 + 790 * 3);
|
||||
}
|
||||
else if (index == 11)
|
||||
{
|
||||
graphics.DrawBitmap(bitmap, 170 + 730 * 1, 200 + 790 * 3);
|
||||
}
|
||||
else if (index == 12)
|
||||
{
|
||||
graphics.DrawBitmap(bitmap, 170 + 730 * 2, 200 + 790 * 3);
|
||||
}
|
||||
bitmap.Dispose();
|
||||
bitmap = null;
|
||||
index++;
|
||||
}
|
||||
//保存A4纸
|
||||
//清内存
|
||||
graphics.Flush();
|
||||
graphics.Dispose();
|
||||
Save(path, a4);
|
||||
a4.Dispose();
|
||||
a4 = null;
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
private SKBitmap GetHaiKangDataMatrixImage2(string text)
|
||||
{
|
||||
SKBitmap bitmap = new SKBitmap(700, 733);
|
||||
SKCanvas graphics = new SKCanvas(bitmap);
|
||||
|
||||
graphics.DrawBitmap(background, new SKRect(0, 0, 700, 733));
|
||||
//在周围画上一圈虚线
|
||||
var pen = new SKPaint
|
||||
{
|
||||
IsAntialias = true,
|
||||
Style = SKPaintStyle.Stroke,
|
||||
Color = SKColors.Black,
|
||||
StrokeWidth = 2,
|
||||
PathEffect = SKPathEffect.CreateDash(new float[] { 11F, 5.5F }, 0)
|
||||
};
|
||||
#region 周边虚线
|
||||
|
||||
//最上面的虚线
|
||||
graphics.DrawLine(0, 0, 700, 0, pen);
|
||||
//左边的虚线
|
||||
graphics.DrawLine(0, 0, 0, 733, pen);
|
||||
//右边
|
||||
graphics.DrawLine(700, 0, 700, 700, pen);
|
||||
//下边
|
||||
graphics.DrawLine(0, 733, 700, 733, pen);
|
||||
#endregion
|
||||
SKBitmap every = GetHaiKangDataMatrixImage(text);
|
||||
|
||||
graphics.DrawBitmap(every, new SKRect(225, 220, 225 + 246, 220 + 246));
|
||||
|
||||
var brush = new SKPaint
|
||||
{
|
||||
Color = SKColors.Black,
|
||||
IsAntialias = true,
|
||||
Style = SKPaintStyle.Fill
|
||||
};
|
||||
graphics.DrawText(text, new SKPoint(410f, 640f), new SKFont
|
||||
{
|
||||
Size = 16f,
|
||||
Typeface = SKTypeface.FromFamilyName("Arial", SKFontStyle.Bold)
|
||||
}, brush);
|
||||
every.Dispose();
|
||||
graphics.Flush();
|
||||
graphics.Dispose();
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
public SKBitmap GetHaiKangDataMatrixImage(string data)
|
||||
{
|
||||
return DataMatrixUtils.EncodeDataMatrix(DmtxSymbolSize.DmtxSymbol14x14, data, 280, out string svg);
|
||||
}
|
||||
|
||||
|
||||
private void GenerateBeiJiaFuFunc(object obj)
|
||||
{
|
||||
GenerateObject parm = (GenerateObject)obj;
|
||||
if (qrcodeList == null)
|
||||
qrcodeList = new Queue<string>();
|
||||
qrcodeList.Clear();
|
||||
if (!parm.IsA4)
|
||||
{
|
||||
//普通生成
|
||||
for (int i = parm.StartNum; i <= parm.EndNum; i++)
|
||||
{
|
||||
qrcodeList.Enqueue(i.ToString().PadLeft(8, '0'));
|
||||
}
|
||||
totalCount = qrcodeList.Count;
|
||||
}
|
||||
else
|
||||
{
|
||||
//A4生成
|
||||
//计算组
|
||||
int count = (parm.EndNum - parm.StartNum + 1);
|
||||
int group = 0;
|
||||
if (count % 6 == 0)
|
||||
group = count / 6;
|
||||
else
|
||||
group = count / 6 + 1;
|
||||
|
||||
int num = parm.StartNum;
|
||||
for (int i = 0; i < (group - 1); i++)
|
||||
{
|
||||
int st = num + 6 * i;
|
||||
int ed = num + 6 * i + 5;
|
||||
string str = "";
|
||||
for (int j = st; j <= ed; j++)
|
||||
{
|
||||
str = str + j.ToString().PadLeft(8, '0') + ",";
|
||||
}
|
||||
str = str.Substring(0, str.Length - 1);
|
||||
qrcodeList.Enqueue(str);
|
||||
}
|
||||
//最后一组开始
|
||||
int st1 = num + 6 * (group - 1);
|
||||
int ed1 = parm.EndNum;
|
||||
string str1 = "";
|
||||
for (int j = st1; j <= ed1; j++)
|
||||
{
|
||||
str1 = str1 + j.ToString().PadLeft(8, '0') + ",";
|
||||
}
|
||||
str1 = str1.Substring(0, str1.Length - 1);
|
||||
qrcodeList.Enqueue(str1);
|
||||
totalCount = qrcodeList.Count;
|
||||
}
|
||||
//根据线程数,创建线程
|
||||
for (int i = 0; i < parm.ThreadCount; i++)
|
||||
{
|
||||
Thread thread = new Thread(GenerateOneBeiJiaFuQrCode);
|
||||
thread.Start(parm);
|
||||
}
|
||||
while (true)
|
||||
{
|
||||
if (!flag)
|
||||
{
|
||||
break;
|
||||
}
|
||||
//判断qrcodeList是否为空
|
||||
bool isEmpty = false;
|
||||
lock (_obj)
|
||||
{
|
||||
isEmpty = qrcodeList.Count == 0;
|
||||
}
|
||||
if (isEmpty && totalCount == 0)
|
||||
{
|
||||
Dispatcher.UIThread.Invoke(() => { GlobalValues.Success("保存成功"); });
|
||||
flag = false;
|
||||
Dispatcher.UIThread.Invoke(() => { button2.Content = "批量生成"; });
|
||||
if (qrcodeList != null)
|
||||
qrcodeList.Clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void GenerateOneBeiJiaFuQrCode(object obj)
|
||||
{
|
||||
GenerateObject parm = (GenerateObject)obj;
|
||||
while (flag)
|
||||
{
|
||||
try
|
||||
{
|
||||
//从list中取出一个
|
||||
bool isEmpty;
|
||||
string txt = "";
|
||||
lock (_obj)
|
||||
{
|
||||
isEmpty = qrcodeList.Count == 0;
|
||||
if (!isEmpty)
|
||||
{
|
||||
txt = qrcodeList.Dequeue();
|
||||
}
|
||||
}
|
||||
if (isEmpty)
|
||||
return;
|
||||
List<string> everyQrcode = txt.Split(',').ToList();
|
||||
if (parm.IsA4)
|
||||
{
|
||||
CreateBeiJiaFuA4AndSave(everyQrcode, parm.SavePath);
|
||||
lock (_obj)
|
||||
{
|
||||
totalCount--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string path = parm.SavePath + everyQrcode[0] + ".png";
|
||||
if (File.Exists(path))
|
||||
{
|
||||
File.Delete(path);
|
||||
}
|
||||
SKBitmap bitmap = this.GetBeiJiaFuDataMatrixImage2(everyQrcode[0]);
|
||||
Save(path, bitmap);
|
||||
bitmap.Dispose();
|
||||
bitmap = null;
|
||||
lock (_obj)
|
||||
{
|
||||
totalCount--;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckBeiJiaFuNum(ref int start, ref int end)
|
||||
{
|
||||
int startNum = 0;
|
||||
int endNum = 0;
|
||||
try
|
||||
{
|
||||
startNum = Convert.ToInt32(this.textBox2.Text.Trim());
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
MessageBox.ShowAsync("开始数据只能为整数");
|
||||
return false;
|
||||
}
|
||||
try
|
||||
{
|
||||
endNum = Convert.ToInt32(this.textBox3.Text.Trim());
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
MessageBox.ShowAsync("结束数据只能为整数");
|
||||
return false;
|
||||
}
|
||||
if (startNum > 99999999)
|
||||
{
|
||||
MessageBox.ShowAsync("开始数据不能超过99999999");
|
||||
return false;
|
||||
}
|
||||
if (endNum > 99999999)
|
||||
{
|
||||
MessageBox.ShowAsync("结束数据不能超过99999999");
|
||||
return false;
|
||||
}
|
||||
if (startNum > endNum)
|
||||
{
|
||||
MessageBox.ShowAsync("开始数据不能大于结束数据");
|
||||
return false;
|
||||
}
|
||||
start = startNum;
|
||||
end = endNum;
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CreateBeiJiaFuA4AndSave(List<string> everyQrcode, string savaPath)
|
||||
{
|
||||
string path = "";
|
||||
if (everyQrcode.Count == 1)
|
||||
{
|
||||
path = savaPath + everyQrcode[0] + ".png";
|
||||
}
|
||||
else
|
||||
{
|
||||
path = savaPath + Convert.ToInt32(everyQrcode[0]) + "_" + Convert.ToInt32(everyQrcode[everyQrcode.Count - 1]) + ".png";
|
||||
}
|
||||
if (File.Exists(path))
|
||||
{
|
||||
File.Delete(path);
|
||||
}
|
||||
//创建一张A4纸
|
||||
SKBitmap a4 = new SKBitmap(2480, 3508);
|
||||
SKCanvas graphics = new SKCanvas(a4);
|
||||
//循环生成start 到end的单个文件
|
||||
int index = 1;
|
||||
foreach (string text in everyQrcode)
|
||||
{
|
||||
SKBitmap bitmap = this.GetBeiJiaFuDataMatrixImage2(text);
|
||||
if (index == 1)
|
||||
{
|
||||
graphics.DrawBitmap(bitmap, 200, 170);
|
||||
}
|
||||
else if (index == 2)
|
||||
{
|
||||
graphics.DrawBitmap(bitmap, 1300, 170);
|
||||
}
|
||||
else if (index == 3)
|
||||
{
|
||||
graphics.DrawBitmap(bitmap, 200, 1270);
|
||||
}
|
||||
else if (index == 4)
|
||||
{
|
||||
graphics.DrawBitmap(bitmap, 1300, 1270);
|
||||
}
|
||||
else if (index == 5)
|
||||
{
|
||||
graphics.DrawBitmap(bitmap, 200, 2370);
|
||||
}
|
||||
else if (index == 6)
|
||||
{
|
||||
graphics.DrawBitmap(bitmap, 1300, 2370);
|
||||
}
|
||||
bitmap.Dispose();
|
||||
bitmap = null;
|
||||
index++;
|
||||
}
|
||||
//保存A4纸
|
||||
graphics.Dispose();
|
||||
Save(path, a4);
|
||||
a4.Dispose();
|
||||
a4 = null;
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
public SKBitmap GetBeiJiaFuDataMatrixImage(string data)
|
||||
{
|
||||
return DataMatrixUtils.EncodeDataMatrix(DmtxSymbolSize.DmtxSymbol12x12, data, 240, out string svg);
|
||||
}
|
||||
|
||||
public SKBitmap GetBeiJiaFuDataMatrixImage2(string text)
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
for (int i = 3; i <= 6; i++)
|
||||
{
|
||||
for (int j = 3; j <= 6; j++)
|
||||
{
|
||||
string item = string.Format("{0}{1}{2}", j, 9 - i, text);
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
List<SKBitmap> list2 = new List<SKBitmap>();
|
||||
foreach (string str2 in list)
|
||||
{
|
||||
list2.Add(this.GetBeiJiaFuDataMatrixImage(str2));
|
||||
}
|
||||
//生成的图片大小
|
||||
SKBitmap image = new SKBitmap(1360 + 4, 1360 + 4);
|
||||
SKCanvas graphics = new SKCanvas(image);
|
||||
//在周围画上一圈虚线
|
||||
var paint = new SKPaint
|
||||
{
|
||||
IsAntialias = true,
|
||||
Style = SKPaintStyle.Stroke,
|
||||
Color = SKColors.Black,
|
||||
StrokeWidth = 5,
|
||||
PathEffect = SKPathEffect.CreateDash(new float[] { 11F, 5.5F }, 0)
|
||||
};
|
||||
#region 周边虚线
|
||||
//最上面的虚线
|
||||
graphics.DrawLine(0, 0, 1364, 0, paint);
|
||||
//左边的虚线
|
||||
graphics.DrawLine(0, 0, 0, 1364, paint);
|
||||
//右边
|
||||
graphics.DrawLine(1362, 0, 1362, 1362, paint);
|
||||
//下边
|
||||
graphics.DrawLine(0, 1362, 1362, 1362, paint);
|
||||
#endregion
|
||||
//graphics.FillRectangle(brush, 0, 0, 4, 0x5a8);
|
||||
//graphics.FillRectangle(brush, 0, 0, 0x5a8, 4);
|
||||
//graphics.FillRectangle(brush, 0x5a4, 0, 0x5a8, 0x5a8);
|
||||
//graphics.FillRectangle(brush, 0, 0x5a4, 0x5a8, 0x5a8);
|
||||
#region 16个二维码
|
||||
//第一行
|
||||
graphics.DrawBitmap(list2[0], 5 * every + 2, 5 * every + 2);
|
||||
graphics.DrawBitmap(list2[1], 25 * every + 2, 5 * every + 2);
|
||||
graphics.DrawBitmap(list2[2], 45 * every + 2, 5 * every + 2);
|
||||
graphics.DrawBitmap(list2[3], 65 * every + 2, 5 * every + 2);
|
||||
//第二行
|
||||
graphics.DrawBitmap(list2[4], 5 * every + 2, 25 * every + 2);
|
||||
graphics.DrawBitmap(list2[5], 25 * every + 2, 25 * every + 2);
|
||||
graphics.DrawBitmap(list2[6], 45 * every + 2, 25 * every + 2);
|
||||
graphics.DrawBitmap(list2[7], 65 * every + 2, 25 * every + 2);
|
||||
//第三行
|
||||
graphics.DrawBitmap(list2[8], 5 * every + 2, 45 * every + 2);
|
||||
graphics.DrawBitmap(list2[9], 25 * every + 2, 45 * every + 2);
|
||||
graphics.DrawBitmap(list2[10], 45 * every + 2, 45 * every + 2);
|
||||
graphics.DrawBitmap(list2[11], 65 * every + 2, 45 * every + 2);
|
||||
//第四行
|
||||
graphics.DrawBitmap(list2[12], 5 * every + 2, 65 * every + 2);
|
||||
graphics.DrawBitmap(list2[13], 25 * every + 2, 65 * every + 2);
|
||||
graphics.DrawBitmap(list2[14], 45 * every + 2, 65 * every + 2);
|
||||
graphics.DrawBitmap(list2[15], 65 * every + 2, 65 * every + 2);
|
||||
#endregion
|
||||
|
||||
#region 上三角
|
||||
var brush = new SKPaint
|
||||
{
|
||||
Color = SKColors.Black,
|
||||
IsAntialias = true,
|
||||
Style = SKPaintStyle.Fill
|
||||
};
|
||||
|
||||
//上三角
|
||||
SKPath path1 = new SKPath();
|
||||
path1.MoveTo(40 * every + 2, 9 * every / 4 + 2);
|
||||
path1.LineTo(40 * every + 9 * every / 4 + 2, 9 * every / 4 + 2);
|
||||
path1.LineTo(40 * every + 9 * every / 4 + 2, 2);
|
||||
graphics.DrawPath(path1, brush);
|
||||
|
||||
|
||||
SKPath path2 = new SKPath();
|
||||
path2.MoveTo(40 * every + 9 * every / 4 + 2 + every / 2, 9 * every / 4 + 2);
|
||||
path2.LineTo(40 * every + 9 * every / 4 + 2 + every / 2, 2);
|
||||
path2.LineTo(45 * every + 2, 9 * every / 4 + 2);
|
||||
graphics.DrawPath(path2, brush);
|
||||
#endregion
|
||||
#region 右三角
|
||||
//右三角
|
||||
SKPath path3 = new SKPath();
|
||||
path3.MoveTo(1364 - (9 * every / 4 + 2), 40 * every + 2);
|
||||
path3.LineTo(1364 - (9 * every / 4 + 2), 40 * every + 9 * every / 4 + 2);
|
||||
path3.LineTo(1364 - 2, 40 * every + 9 * every / 4 + 2);
|
||||
graphics.DrawPath(path3, brush);
|
||||
|
||||
|
||||
SKPath path4 = new SKPath();
|
||||
path4.MoveTo(1364 - (9 * every / 4 + 2), 40 * every + 9 * every / 4 + 2 + every / 2);
|
||||
path4.LineTo(1364 - 2, 40 * every + 9 * every / 4 + 2 + every / 2);
|
||||
path4.LineTo(1364 - (9 * every / 4 + 2), 45 * every + 2);
|
||||
graphics.DrawPath(path4, brush);
|
||||
|
||||
#endregion
|
||||
#region 左三角 下三角
|
||||
graphics.DrawBitmap(left, new SKRect(2, 40 * every + 2, 2 + 9 * every / 4, 40 * every + 2 + 5 * every));
|
||||
graphics.DrawBitmap(down, new SKRect(40 * every + 2, 1364 - 2 - 9 * every / 4, 40 * every + 2 + 5 * every, 1364 - 2 - 9 * every / 4 + 9 * every / 4));
|
||||
#endregion
|
||||
#region 中间十字
|
||||
graphics.DrawRect(40 * every + 2 - 4, 40 * every + 9 * every / 4 + 2, 5 * every + 8, 8, brush);
|
||||
graphics.DrawRect(40 * every + 9 * every / 4 + 2, 40 * every + 2 - 4, 8, 5 * every + 8, brush);
|
||||
#endregion
|
||||
#region X Y
|
||||
graphics.DrawText("Y", new SKPoint(580f, 50f), SKTextAlign.Center, new SKFont
|
||||
{
|
||||
Size = 50f,
|
||||
Typeface = SKTypeface.FromFamilyName("Arial", SKFontStyle.Bold)
|
||||
}, brush);
|
||||
graphics.DrawText("X", new SKPoint(1340f, 560f), SKTextAlign.Center, new SKFont
|
||||
{
|
||||
Size = 50f,
|
||||
Typeface = SKTypeface.FromFamilyName("Arial", SKFontStyle.Bold)
|
||||
}, brush);
|
||||
text = ("TAG " + text).Insert(6, " ").Insert(10, " ");
|
||||
graphics.DrawText(text, new SKPoint(850f, 39f), SKTextAlign.Center, new SKFont
|
||||
{
|
||||
Size = 35f,
|
||||
Typeface = SKTypeface.FromFamilyName("Arial", SKFontStyle.Bold)
|
||||
}, brush);
|
||||
#endregion
|
||||
graphics.Flush();
|
||||
graphics.Dispose();
|
||||
foreach (SKBitmap bitmap2 in list2)
|
||||
{
|
||||
bitmap2.Dispose();
|
||||
}
|
||||
list2 = null;
|
||||
GC.Collect();
|
||||
////去除白色,将白色转成透明
|
||||
//image.MakeTransparent(System.Drawing.Color.White);
|
||||
////将image转换为8.5cm * 8.5cm(1004px) dpi改成300像素/英寸
|
||||
SKBitmap bitmap = new SKBitmap(1004, 1004);
|
||||
using (SKCanvas canvas = new SKCanvas(bitmap))
|
||||
{
|
||||
canvas.DrawBitmap(image, new SKRect(0, 0, 1004, 1004));
|
||||
}
|
||||
//bitmap.SetResolution(300, 300);
|
||||
//return bitmap;
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class GenerateObject
|
||||
{
|
||||
public int StartNum { get; set; }
|
||||
public int EndNum { get; set; }
|
||||
public int ThreadCount { get; set; }
|
||||
public string SavePath { get; set; }
|
||||
public bool IsA4 { get; set; }
|
||||
}
|
||||
}
|
||||
66
常用工具集/Views/03图片相关/色卡包.axaml
Normal file
66
常用工具集/Views/03图片相关/色卡包.axaml
Normal file
@@ -0,0 +1,66 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" Height="660" Width="815"
|
||||
xmlns:vm ="clr-namespace:常用工具集.ViewModel._03图片相关"
|
||||
x:Class="常用工具集.色卡包"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="vm:色卡包ViewModel">
|
||||
<UserControl.DataContext>
|
||||
<vm:色卡包ViewModel />
|
||||
</UserControl.DataContext>
|
||||
<Grid ColumnDefinitions="2*,3*">
|
||||
<Grid Grid.Column="0" ColumnDefinitions="*,*,*,*" RowDefinitions="*,*,*,*,*,*,*,*,*,*,*,*,*,*,*">
|
||||
<Button Grid.Row="0" Grid.Column="0" CornerRadius="10" Content="钴蓝" Command="{Binding ButtonCmd}" CommandParameter="钴蓝" Width="80" Height="30" Background="#569DD9" Foreground="White" />
|
||||
<Button Grid.Row="1" Grid.Column="0" CornerRadius="10" Content="琉璃色" Command="{Binding ButtonCmd}" CommandParameter="琉璃色" Width="80" Height="30" Background="#1D50A2" Foreground="White"/>
|
||||
<Button Grid.Row="2" Grid.Column="0" CornerRadius="10" Content="浓蓝" Command="{Binding ButtonCmd}" CommandParameter="浓蓝" Width="80" Height="30" Background="#005977" Foreground="White"/>
|
||||
<Button Grid.Row="3" Grid.Column="0" CornerRadius="10" Content="青金石" Command="{Binding ButtonCmd}" CommandParameter="青金石" Width="80" Height="30" Background="#134098" Foreground="White"/>
|
||||
<Button Grid.Row="4" Grid.Column="0" CornerRadius="10" Content="深青灰" Command="{Binding ButtonCmd}" CommandParameter="深青灰" Width="80" Height="30" Background="#005178" Foreground="White"/>
|
||||
<Button Grid.Row="5" Grid.Column="0" CornerRadius="10" Content="绯红" Command="{Binding ButtonCmd}" CommandParameter="绯红" Width="80" Height="30" Background="#E72520" Foreground="White"/>
|
||||
<Button Grid.Row="6" Grid.Column="0" CornerRadius="10" Content="桃色" Command="{Binding ButtonCmd}" CommandParameter="桃色" Width="80" Height="30" Background="#DE7896" Foreground="White"/>
|
||||
<Button Grid.Row="7" Grid.Column="0" CornerRadius="10" Content="正红" Command="{Binding ButtonCmd}" CommandParameter="正红" Width="80" Height="30" Background="#D8210D" Foreground="White"/>
|
||||
<Button Grid.Row="8" Grid.Column="0" CornerRadius="10" Content="黄橙色" Command="{Binding ButtonCmd}" CommandParameter="黄橙色" Width="80" Height="30" Background="#E7A53B" Foreground="White"/>
|
||||
<Button Grid.Row="9" Grid.Column="0" CornerRadius="10" Content="橘红色" Command="{Binding ButtonCmd}" CommandParameter="橘红色" Width="80" Height="30" Background="#ED6D00" Foreground="White"/>
|
||||
<Button Grid.Row="10" Grid.Column="0" CornerRadius="10" Content="太阳橙" Command="{Binding ButtonCmd}" CommandParameter="太阳橙" Width="80" Height="30" Background="#F18D00" Foreground="White"/>
|
||||
<Button Grid.Row="11" Grid.Column="0" CornerRadius="10" Content="酒红" Command="{Binding ButtonCmd}" CommandParameter="酒红" Width="80" Height="30" Background="#B5003E" Foreground="White"/>
|
||||
<Button Grid.Row="12" Grid.Column="0" CornerRadius="10" Content="牡丹红" Command="{Binding ButtonCmd}" CommandParameter="牡丹红" Width="80" Height="30" Background="#F1006F" Foreground="White"/>
|
||||
<Button Grid.Row="13" Grid.Column="0" CornerRadius="10" Content="蔷薇色" Command="{Binding ButtonCmd}" CommandParameter="蔷薇色" Width="80" Height="30" Background="#D7003F" Foreground="White"/>
|
||||
<Button Grid.Row="14" Grid.Column="0" CornerRadius="10" Content="洋红" Command="{Binding ButtonCmd}" CommandParameter="洋红" Width="80" Height="30" Background="#E61C64" Foreground="White"/>
|
||||
<Button Grid.Row="0" Grid.Column="1" CornerRadius="10" Content="梨色" Command="{Binding ButtonCmd}" CommandParameter="梨色" Width="80" Height="30" Background="#FCDDAE" Foreground="White"/>
|
||||
<Button Grid.Row="1" Grid.Column="1" CornerRadius="10" Content="麦色" Command="{Binding ButtonCmd}" CommandParameter="麦色" Width="80" Height="30" Background="#CDB081" Foreground="White"/>
|
||||
<Button Grid.Row="2" Grid.Column="1" CornerRadius="10" Content="椰棕色" Command="{Binding ButtonCmd}" CommandParameter="椰棕色" Width="80" Height="30" Background="#7A4817" Foreground="White"/>
|
||||
<Button Grid.Row="3" Grid.Column="1" CornerRadius="10" Content="草绿" Command="{Binding ButtonCmd}" CommandParameter="草绿" Width="80" Height="30" Background="#A9C368" Foreground="White"/>
|
||||
<Button Grid.Row="4" Grid.Column="1" CornerRadius="10" Content="浅绿" Command="{Binding ButtonCmd}" CommandParameter="浅绿" Width="80" Height="30" Background="#CCE198" Foreground="White"/>
|
||||
<Button Grid.Row="5" Grid.Column="1" CornerRadius="10" Content="闪光绿" Command="{Binding ButtonCmd}" CommandParameter="闪光绿" Width="80" Height="30" Background="#D9E480" Foreground="Red"/>
|
||||
<Button Grid.Row="6" Grid.Column="1" CornerRadius="10" Content="贝色" Command="{Binding ButtonCmd}" CommandParameter="贝色" Width="80" Height="30" Background="#FCFBF4" Foreground="Red"/>
|
||||
<Button Grid.Row="7" Grid.Column="1" CornerRadius="10" Content="黑灰" Command="{Binding ButtonCmd}" CommandParameter="黑灰" Width="80" Height="30" Background="#534A46" Foreground="White"/>
|
||||
<Button Grid.Row="8" Grid.Column="1" CornerRadius="10" Content="鸠羽灰" Command="{Binding ButtonCmd}" CommandParameter="鸠羽灰" Width="80" Height="30" Background="#9E8B8E" Foreground="White"/>
|
||||
<Button Grid.Row="9" Grid.Column="1" CornerRadius="10" Content="浅灰" Command="{Binding ButtonCmd}" CommandParameter="浅灰" Width="80" Height="30" Background="#9F9FA0" Foreground="White"/>
|
||||
<Button Grid.Row="10" Grid.Column="1" CornerRadius="10" Content="濡雨色" Command="{Binding ButtonCmd}" CommandParameter="濡雨色" Width="80" Height="30" Background="#000A00" Foreground="White"/>
|
||||
<Button Grid.Row="11" Grid.Column="1" CornerRadius="10" Content="古代紫" Command="{Binding ButtonCmd}" CommandParameter="古代紫" Width="80" Height="30" Background="#D0ABBF" Foreground="White"/>
|
||||
<Button Grid.Row="12" Grid.Column="1" CornerRadius="10" Content="青紫色" Command="{Binding ButtonCmd}" CommandParameter="青紫色" Width="80" Height="30" Background="#775F9F" Foreground="White"/>
|
||||
<Button Grid.Row="13" Grid.Column="1" CornerRadius="10" Content="薰衣草" Command="{Binding ButtonCmd}" CommandParameter="薰衣草" Width="80" Height="30" Background="#D4C4DB" Foreground="White"/>
|
||||
<Button Grid.Row="14" Grid.Column="1" CornerRadius="10" Content="紫色" Command="{Binding ButtonCmd}" CommandParameter="紫色" Width="80" Height="30" Background="#920783" Foreground="White"/>
|
||||
<Button Grid.Row="0" Grid.Column="2" CornerRadius="10" Content="紫水晶" Command="{Binding ButtonCmd}" CommandParameter="紫水晶" Width="80" Height="30" Background="#7E4985" Foreground="White"/>
|
||||
<Button Grid.Row="1" Grid.Column="2" CornerRadius="10" Content="卡机色" Command="{Binding ButtonCmd}" CommandParameter="卡机色" Width="80" Height="30" Background="#B08727" Foreground="White"/>
|
||||
<Button Grid.Row="2" Grid.Column="2" CornerRadius="10" Content="鲜黄色" Command="{Binding ButtonCmd}" CommandParameter="鲜黄色" Width="80" Height="30" Background="#FFEA00" Foreground="White"/>
|
||||
<Button Grid.Row="3" Grid.Column="2" CornerRadius="10" Content="月亮黄" Command="{Binding ButtonCmd}" CommandParameter="月亮黄" Width="80" Height="30" Background="#FFED61" Foreground="White"/>
|
||||
<Button Grid.Row="4" Grid.Column="2" CornerRadius="10" Content="铬绿" Command="{Binding ButtonCmd}" CommandParameter="铬绿" Width="80" Height="30" Background="#6ABD78" Foreground="White"/>
|
||||
<Button Grid.Row="5" Grid.Column="2" CornerRadius="10" Content="孔雀绿" Command="{Binding ButtonCmd}" CommandParameter="孔雀绿" Width="80" Height="30" Background="#007F77" Foreground="White"/>
|
||||
<Button Grid.Row="6" Grid.Column="2" CornerRadius="10" Content="墨绿" Command="{Binding ButtonCmd}" CommandParameter="墨绿" Width="80" Height="30" Background="#006450" Foreground="White"/>
|
||||
<Button Grid.Row="7" Grid.Column="2" CornerRadius="10" Content="青灰绿" Command="{Binding ButtonCmd}" CommandParameter="青灰绿" Width="80" Height="30" Background="#418D6D" Foreground="White"/>
|
||||
<Button Grid.Row="8" Grid.Column="2" CornerRadius="10" Content="铬黄" Command="{Binding ButtonCmd}" CommandParameter="铬黄" Width="80" Height="30" Background="#FDD000" Foreground="White"/>
|
||||
<Button Grid.Row="9" Grid.Column="2" CornerRadius="10" Content="芥予色" Command="{Binding ButtonCmd}" CommandParameter="芥予色" Width="80" Height="30" Background="#D6C55F" Foreground="White"/>
|
||||
<Button Grid.Row="10" Grid.Column="2" CornerRadius="10" Content="那不勒斯黄" Command="{Binding ButtonCmd}" CommandParameter="那不勒斯黄" Width="80" Height="30" Background="#D7CC48" Foreground="White"/>
|
||||
<Button Grid.Row="11" Grid.Column="2" CornerRadius="10" Content="秋菊黄" Command="{Binding ButtonCmd}" CommandParameter="秋菊黄" Width="80" Height="30" Background="#FFEC94" Foreground="White"/>
|
||||
<Button Grid.Row="12" Grid.Column="2" CornerRadius="10" Content="地平线" Command="{Binding ButtonCmd}" CommandParameter="地平线" Width="80" Height="30" Background="#B0DCD5" Foreground="White"/>
|
||||
<Button Grid.Row="13" Grid.Column="2" CornerRadius="10" Content="灰瓷" Command="{Binding ButtonCmd}" CommandParameter="灰瓷" Width="80" Height="30" Background="#AFD3D9" Foreground="White"/>
|
||||
<Button Grid.Row="14" Grid.Column="2" CornerRadius="10" Content="浓蓝绿" Command="{Binding ButtonCmd}" CommandParameter="浓蓝绿" Width="80" Height="30" Background="#00697F" Foreground="White"/>
|
||||
<Button Grid.Row="0" Grid.Column="3" CornerRadius="10" Content="深蓝" Command="{Binding ButtonCmd}" CommandParameter="深蓝" Width="80" Height="30" Background="#006296" Foreground="White"/>
|
||||
</Grid>
|
||||
<Grid Grid.Column="1">
|
||||
<Image Source="{Binding ImageSource}" Stretch="Fill"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
13
常用工具集/Views/03图片相关/色卡包.axaml.cs
Normal file
13
常用工具集/Views/03图片相关/色卡包.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace 常用工具集;
|
||||
|
||||
public partial class 色卡包 : UserControl
|
||||
{
|
||||
public 色卡包()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user