C# 实现的图片盖章功能,支持拖拽、旋转、放缩、保存实现的图片盖章功能,支持拖拽、旋转、放缩、保存
主要介绍了C# 实现的图片盖章功能,支持拖拽、旋转、放缩、保存,需要的朋友可以参考下
实现图片盖章功能,在图片上点击,增加“图章”小图片,可以拖拽“图章”到任意位置,也可以点击图章右下角园框,令图片跟
着鼠标旋转和放缩。
操作方法:1.点击增加“图章”2.选中移动图标3.点中右下角放缩旋转图章。
效果图:
实现代码如下:
1. 窗口Xaml代码
复制代码 代码如下:
<Window x:Class="Lenovo.YogaPaster.ImageEditWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="ImageEditWindow" Height="300" Width="300">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="20*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Canvas x:Name="canvas"
Background="Yellow" />
<Button Content="保存成图片" Click="Button_Click_1" Grid.Row="1" HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
</Window>
2. 窗口后台代码:
复制代码 代码如下:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;