惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
Project Zero
Project Zero
博客园 - 聂微东
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
云风的 BLOG
云风的 BLOG
Microsoft Azure Blog
Microsoft Azure Blog
F
Fortinet All Blogs
Martin Fowler
Martin Fowler
Jina AI
Jina AI
C
Check Point Blog
博客园_首页
The GitHub Blog
The GitHub Blog
The Hacker News
The Hacker News
T
The Blog of Author Tim Ferriss
V
Vulnerabilities – Threatpost
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cisco Blogs
人人都是产品经理
人人都是产品经理
V
Visual Studio Blog
A
Arctic Wolf
博客园 - 三生石上(FineUI控件)
P
Privacy International News Feed
Application and Cybersecurity Blog
Application and Cybersecurity Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Forbes - Security
Forbes - Security
阮一峰的网络日志
阮一峰的网络日志
Engineering at Meta
Engineering at Meta
T
Troy Hunt's Blog
Microsoft Security Blog
Microsoft Security Blog
Spread Privacy
Spread Privacy
Schneier on Security
Schneier on Security
K
Kaspersky official blog
宝玉的分享
宝玉的分享
Google DeepMind News
Google DeepMind News
V2EX - 技术
V2EX - 技术
Google DeepMind News
Google DeepMind News
AWS News Blog
AWS News Blog
Know Your Adversary
Know Your Adversary
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Y
Y Combinator Blog
大猫的无限游戏
大猫的无限游戏
S
Security Affairs
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - Franky
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The Register - Security
The Register - Security
P
Proofpoint News Feed
小众软件
小众软件
S
Securelist
T
Tor Project blog

博客园 - Rock Wang

Asp.Net Core Web Api基于cookie的安全验证 C#语言新特性(6.0-8.0) C#中Struct和Class的区别 iOS真机调试之免费预配(Free provisioning) iOS真机调试 Spring Boot学习笔记(1) Java学习笔记(9) Java学习笔记(7) Java学习笔记(6) Java学习笔记(5) Java学习笔记(4) Idea常用功能汇总 Java学习笔记(3) Java学习笔记(2) Java学习笔记(1) 如何开发NPM包 支持续传功能的ASP.NET WEB API文件下载服务 ASP.NET MVC 阻止通过Url直接访问服务器上的静态文件 VS2013/VS2015/VS2017通过oschina托管代码
c#抓屏功能在DPI缩放后,截到的图片不完整的问题
Rock Wang · 2017-04-26 · via 博客园 - Rock Wang
        /// <summary>
        /// 获取屏幕快照
        /// </summary>
        /// <returns></returns>
        public static Bitmap GetScreenSnapshot()
        {
            Bitmap bitmap = null;
            try
            {
                Graphics g = Graphics.FromHwnd(IntPtr.Zero);
                //100%的时候,DPI是96;这条语句的作用时获取放大比例
                float factor = g.DpiX / 96;
                Rectangle rc = new Rectangle(0, 0, (int)(SystemParameters.PrimaryScreenWidth * factor), (int)(SystemParameters.PrimaryScreenHeight * factor));
                bitmap = new Bitmap(rc.Width, rc.Height, PixelFormat.Format32bppArgb);
                using (Graphics memoryGrahics = Graphics.FromImage(bitmap))
                {
                    memoryGrahics.CopyFromScreen(rc.X, rc.Y, 0, 0, rc.Size, CopyPixelOperation.SourceCopy);
                }
            }
            catch (Exception ex)
            {
                NlogHelper.Error("截屏失败", ex);
            }
            return bitmap;
        }