wpf实现简易画板功能(带截取画板,签名截图等等)

本文介绍了如何在WPF应用中实现一个简易画板功能,包括画板操作和截图功能。用户可以在画板上进行绘图,并能截取红色方框选定区域的内容,保存到指定文件夹。
摘要由CSDN通过智能技术生成

参照自:https://www.cnblogs.com/jixin/p/4730170.html
https://blog.csdn.net/u012408847/article/details/86482399

截图功能将会把红色方块区域内的内容截取下来,保存在img文件夹中。
在这里插入图片描述
window1.xaml

<Window x:Class="_1_5GraphicsWpf.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        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:local="clr-namespace:_1_5GraphicsWpf"
        xmlns:cvr="clr-namespace:_1_5GraphicsWpf.ControlValidationRule"
        mc:Ignorable="d"
        Title="Window1" Height="450" Width="800">
    <Grid>
        <DockPanel  Background="AliceBlue">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="5*"></ColumnDefinition>
                    <ColumnDefinition Width="13*"></ColumnDefinition>
                    
                </Grid.ColumnDefinitions>
            
            <Canvas Grid.Column="1" x:Name="myCanvas"   DockPanel.Dock="Right" Background="LightGray" 
                    PreviewMouseLeftButtonDown="Canvas_PreviewMouseLeftButtonDown" PreviewMouseMove="Canvas_PreviewMouseMove"
                    MouseLeftButtonUp="MyCanvas_MouseLeftButtonUp" 
                    ></Canvas>
            
                <Grid DockPanel.Dock="Left" x:Name="LeftDockPanel">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="3*"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="30px"></RowDefinition>
                    <RowDefinition Height="30px"></RowDefinition>
                    <RowDefinition Height="30px"></RowDefinition>
                    <RowDefinition Height="30px"></RowDefinition>
                    <RowDefinition Height="30px"></RowDefinition>
                    <RowDefinition Height="30px"></RowDefinition>
                    <RowDefinition Height="30px"></RowDefinition>
                </Grid.RowDefinitions>
                <Label Grid.Column="0" Grid.Row="0">颜色œ˜œ˜œ˜œ˜</Label>
                <ComboBox x:Name="ComboColor" Grid.Row="0" Grid.Column="1" Margin="6 3"
                          SelectedValuePath="{Binding Path=ID}" SelectedIndex="{Binding Path=Combo_ColorIndex}" >
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="{Binding Path=PColor}"></TextBlock>
                            </StackPanel>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>
                
                <
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值