• 大小: 193KB
    文件类型: .rar
    金币: 2
    下载: 2 次
    发布日期: 2021-06-12
  • 语言: C#
  • 标签: wpf  c#  

资源简介

c# 实现类似于电脑版微信的截图功能,可进行截图、鼠标区域局部放大等功能。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;

namespace RisCaptureLib
{
    public class AmplifyImage
    {
        private const int MAX = 5;
        private Graphics gpOrgin;    //画板,用于画截图
        private Graphics gpMag;      //画板,用于画放大图
        private Bitmap btOrgin;     //画布,桌面原图
        private Bitmap btMag;       //放大后图片
        private Size mySize;        //桌面截取范围即pictureBox的大小
        private int mul;            //放大倍数

        public int Mul
        {
            get
            {
                return mul;
            }
            set
            {
                mul = value < MAX ? value : MAX;
                refreshMul();
            }
        }

        public Size MySize
        {
            get
            {
                return mySize;
            }
            set
            {
                mySize = value;
                refreshSize();
            }
        }

        /// 
        /// 构造函数
        /// 

        /// pictureBox的Size
        /// 放大倍数,默认为1
        public AmplifyImage(Size picint m = 1)
        {
            mul = m;
            mySize = pic;
            btOrgin = new Bitmap(mySize.Width / mul mySize.Height / mul);
            btMag = new Bitmap(mySize.Width mySize.Height);
            gpOrgin = Graphics.FromImage((Image)btOrgin);
            gpMag = Graphics.FromImage((Image)btMag);
        }

        /// 
        /// 实时取得鼠标附件视图的放大图
        /// 

        /// 鼠标所在的x坐标
        /// 鼠标所在的y坐标
        /// 放大后的图片
        public Bitmap getMag(int x int y)
        {
            gpOrgin.CopyFromScreen(x y 0 0 btOrgin.Size);
            gpMag.DrawImage(btOrgin 0 0 btMag.Width btMag.Height);
            return btMag;
        }

        private void refreshSize()//刷新变量Size的后续操作
        {
            btOrgin = new Bitmap(mySize.Width / mul mySize.Height / mul);
            btMag = new Bitmap(mySize.Width mySize.Height);
            gpOrgin = Graphics.FromImage((Image)btOrgin);
            gpMag = Graphics.FromImage((Image)btMag);
        }

        private void refreshMul()//刷新变量mul的后续操作
        {
            btOrgin = new Bitmap(mySize.Width / mul mySize.Height / mul);
            gpOrgin = Graphics.FromImage((Image)btOrgin);
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    ..A..H.     87552  2018-11-02 11:26  ScreenShot\.vs\ScreenShot\v14\.suo

    ..A..H.      1287  2010-08-20 14:54  ScreenShot\RisCaptureLib\.copyarea.db

     文件       2749  2018-11-01 13:29  ScreenShot\RisCaptureLib\AmplifyImage.cs

     文件      41472  2018-11-02 11:26  ScreenShot\RisCaptureLib\bin\Debug\RisCaptureLib.dll

     文件      77312  2018-11-02 11:26  ScreenShot\RisCaptureLib\bin\Debug\RisCaptureLib.pdb

     文件       2084  2018-10-30 17:22  ScreenShot\RisCaptureLib\BitmapCursor.cs

     文件        547  2018-11-01 13:44  ScreenShot\RisCaptureLib\Config.cs

     文件       4416  2018-10-31 08:52  ScreenShot\RisCaptureLib\HelperMethods.cs

     文件       1473  2018-11-01 11:43  ScreenShot\RisCaptureLib\Indicatorobject.cs

     文件      14264  2018-11-01 13:44  ScreenShot\RisCaptureLib\MaskCanvas.cs

     文件      13419  2018-11-01 13:41  ScreenShot\RisCaptureLib\MaskWindow.cs

     文件       1809  2018-10-31 17:36  ScreenShot\RisCaptureLib\MoveThumb.cs

     文件       3579  2018-11-01 11:38  ScreenShot\RisCaptureLib\obj\Debug\AmplifyImageDisplay.g.i.cs

     文件        790  2018-10-31 14:55  ScreenShot\RisCaptureLib\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       7025  2018-11-02 11:11  ScreenShot\RisCaptureLib\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       3015  2018-11-02 11:26  ScreenShot\RisCaptureLib\obj\Debug\GeneratedInternalTypeHelper.g.cs

     文件       3015  2018-11-02 11:26  ScreenShot\RisCaptureLib\obj\Debug\GeneratedInternalTypeHelper.g.i.cs

     文件       2298  2018-11-02 11:26  ScreenShot\RisCaptureLib\obj\Debug\RisCaptureLib.csproj.FileListAbsolute.txt

     文件       2054  2018-11-01 13:21  ScreenShot\RisCaptureLib\obj\Debug\RisCaptureLib.csprojResolveAssemblyReference.cache

     文件      41472  2018-11-02 11:26  ScreenShot\RisCaptureLib\obj\Debug\RisCaptureLib.dll

     文件       7213  2018-11-02 11:26  ScreenShot\RisCaptureLib\obj\Debug\RisCaptureLib.g.resources

     文件      77312  2018-11-02 11:26  ScreenShot\RisCaptureLib\obj\Debug\RisCaptureLib.pdb

     文件        249  2018-11-02 11:26  ScreenShot\RisCaptureLib\obj\Debug\RisCaptureLib_MarkupCompile.cache

     文件        248  2018-11-02 11:11  ScreenShot\RisCaptureLib\obj\Debug\RisCaptureLib_MarkupCompile.i.cache

     文件        269  2018-11-02 11:11  ScreenShot\RisCaptureLib\obj\Debug\RisCaptureLib_MarkupCompile.i.lref

     文件        267  2018-11-02 11:26  ScreenShot\RisCaptureLib\obj\Debug\RisCaptureLib_MarkupCompile.lref

     文件       5657  2018-11-02 11:26  ScreenShot\RisCaptureLib\obj\Debug\Themes\generic.baml

     文件       1264  2018-11-02 11:26  ScreenShot\RisCaptureLib\obj\Debug\ToolBaecontrol.baml

     文件       5084  2018-11-02 11:26  ScreenShot\RisCaptureLib\obj\Debug\ToolBaecontrol.g.cs

     文件       5084  2018-11-02 11:26  ScreenShot\RisCaptureLib\obj\Debug\ToolBaecontrol.g.i.cs

............此处省略78个文件信息

评论

共有 条评论