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

推荐订阅源

D
Darknet – Hacking Tools, Hacker News & Cyber Security
V
Vulnerabilities – Threatpost
Cloudbric
Cloudbric
G
GRAHAM CLULEY
S
Securelist
Schneier on Security
Schneier on Security
Help Net Security
Help Net Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Project Zero
Project Zero
Spread Privacy
Spread Privacy
P
Privacy International News Feed
C
Cyber Attacks, Cyber Crime and Cyber Security
Cisco Talos Blog
Cisco Talos Blog
T
Tailwind CSS Blog
博客园_首页
有赞技术团队
有赞技术团队
Simon Willison's Weblog
Simon Willison's Weblog
Stack Overflow Blog
Stack Overflow Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Latest news
Latest news
T
Tor Project blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Attack and Defense Labs
Attack and Defense Labs
www.infosecurity-magazine.com
www.infosecurity-magazine.com
O
OpenAI News
J
Java Code Geeks
T
Tenable Blog
K
Kaspersky official blog
AWS News Blog
AWS News Blog
S
Security @ Cisco Blogs
The GitHub Blog
The GitHub Blog
T
Threatpost
月光博客
月光博客
H
Heimdal Security Blog
Security Latest
Security Latest
The Hacker News
The Hacker News
Y
Y Combinator Blog
A
Arctic Wolf
Apple Machine Learning Research
Apple Machine Learning Research
C
Cisco Blogs
美团技术团队
Microsoft Security Blog
Microsoft Security Blog
Hugging Face - Blog
Hugging Face - Blog
T
The Blog of Author Tim Ferriss
C
CERT Recently Published Vulnerability Notes
D
Docker
Google Online Security Blog
Google Online Security Blog
D
DataBreaches.Net
V
Visual Studio Blog
H
Help Net Security

博客园 - Emosen

Win7 不能安装SQL Server 2005 Management Studio Express.msi解决办法 WINDOWS 画空心字 - Emosen - 博客园 ZT--文本显示尺寸计算(关于控件的尺寸定义) create database link 数据库主键设计之思考 开始→运行→输入的命令集锦 开发人员一定要加入收藏夹的网站 SQL Server 2005 Express 远程访问设置方法 Microsoft SQL Server 2005 Express 远程访问设置详述,100%成功篇 编程十诫 转贴:最常见问题(FAQ)留着慢慢学习--微软.net精简框架最常见问题 ndis 相关资料 PHP+PDO+ORALCE 实例演示 PHP+PDO+ORALCE 配置说明 Oracle 数据类型 Oracle分页查询语句(一) 网页UTF8编码--多出空白行的问题(ZT) 开源性能测试工具 - ApacheBench(简称ab) 介绍 用Eclipse开发PHP项目
C# 改变图片大小的功能代码片段 (wince5)
Emosen · 2009-04-14 · via 博客园 - Emosen

                if (pictureBox1.Image == null) return;
                Bitmap srcmap = null, destbit =null;
                Graphics g = null;
                try
                {
                    //例如:图片目标大小为:320*240

                    GC.Collect();GC.WaitForPendingFinalizers();
                    srcmap = new Bitmap(pictureBox1.Image);
                    //Bitmap srcmap = new Bitmap(strImageFile);
                    //图片文件=strImageFile,直接NEW出某图片文件时,如图片太太会出现OutOfMemory的异常哦,不知如何解决@@
                    destbit = new Bitmap(320, 240);
                    Rectangle srcRec = new Rectangle(0, 0, srcmap.Width, srcmap.Width);
                    Rectangle destRec = new Rectangle(0, 0,  320,240);
                    g = Graphics.FromImage(destbit);
                    g.DrawImage(srcmap, destRec, srcRec, GraphicsUnit.Pixel);
                    destbit.Save(fileName, System.Drawing.Imaging.ImageFormat.Jpeg);//保存较大Jpeg,如1280*1024图片时,比较消耗内在哦。
                    if (g != null) { g.Dispose(); g = null; }
                    if (destbit != null) { destbit.Dispose(); destbit = null; }
                    if (srcmap != null) { srcmap.Dispose(); srcmap = null; }
                    GC.Collect();GC.WaitForPendingFinalizers();

                }
                catch (Exception ex)
                {
                    if (g != null) { g.Dispose(); g = null; }
                    if (destbit != null) { destbit.Dispose(); destbit = null; }
                    if (srcmap != null) { srcmap.Dispose(); srcmap = null; }
                    GC.Collect();GC.WaitForPendingFinalizers();
                   

                    MessageBox.Show(ex.Message);
                }

                //如果大家有更好的方法,请多多指教,TKS!

                参考源:http://www.vbforums.com/showthread.php?t=560892