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

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
The GitHub Blog
The GitHub Blog
C
Check Point Blog
博客园_首页
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
F
Full Disclosure
Microsoft Security Blog
Microsoft Security Blog
爱范儿
爱范儿
Recent Announcements
Recent Announcements
阮一峰的网络日志
阮一峰的网络日志
G
GRAHAM CLULEY
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Threat Research - Cisco Blogs
C
Cybersecurity and Infrastructure Security Agency CISA
V
Vulnerabilities – Threatpost
K
Kaspersky official blog
博客园 - 司徒正美
S
Schneier on Security
T
The Exploit Database - CXSecurity.com
Project Zero
Project Zero
云风的 BLOG
云风的 BLOG
Cisco Talos Blog
Cisco Talos Blog
Know Your Adversary
Know Your Adversary
雷峰网
雷峰网
V
V2EX - 技术
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Spread Privacy
Spread Privacy
罗磊的独立博客
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
SecWiki News
SecWiki News
Schneier on Security
Schneier on Security
O
OpenAI News
Jina AI
Jina AI
PCI Perspectives
PCI Perspectives
Cyberwarzone
Cyberwarzone
Y
Y Combinator Blog
Apple Machine Learning Research
Apple Machine Learning Research
B
Blog RSS Feed
I
InfoQ
D
Docker
P
Palo Alto Networks Blog
Recorded Future
Recorded Future
M
MIT News - Artificial intelligence
博客园 - Franky
B
Blog
Scott Helme
Scott Helme
博客园 - 叶小钗
D
DataBreaches.Net

博客园 - 悟空空

Firefox IE兼容性js笔记 Firefox,Safari与IE兼容性问题整理 在cs类中调用嵌入资源并输出流 - 悟空空 - 博客园 调用dll给winform程序创建所有用户均可使用的快捷方式 SQL Server获取TEXT字段的内容长度 正则表达式笔记 Silverlight 4简体中文正式版脱机帮助文档安装说明 [原创]利用CPAU静默调用其它程序 - 悟空空 - 博客园 CPAU参数说明 - 悟空空 - 博客园 apache_2.2.4和php-5.3.2安装过程问题整理 Rectangle 属性 SSL网站自动安装根目录证书(整理备用)javascript - 悟空空 - 博客园 NND年年回家这么难买火车票 DoubleAnimation 类 Storyboard 类 - 悟空空 - 博客园 Windows Presentation Foundation 中的 Pack URI WPF 性能分析工具 CompositionTarget 类 SolidColorBrush 类 - 悟空空 - 博客园
CroppedBitmap 类
悟空空 · 2010-01-18 · via 博客园 - 悟空空

CroppedBitmap 类

更新:2007 年 11 月

命名空间:  System.Windows.Media.Imaging
程序集:  PresentationCore(在 PresentationCore.dll 中)

CroppedBitmap 实现 ISupportInitialize 接口,以对多个属性的初始化进行优化。只能在对象初始化过程中对属性进行更改。调用 BeginInit 以表示初始化开始;调用 EndInit 以表示初始化结束。初始化后,将忽略属性更改。

使用 CroppedBitmap(BitmapSource, Int32Rect) 构造函数创建的 CroppedBitmap 对象将自动初始化,且属性无法更改。

如果在应用转换后将图像保存到文件,则必须更新与图像数据相关的元数据标记。

使用此类的 SourceRect 属性定义要裁剪的位图区域。

// Create an Image element.
Image croppedImage = new Image();
croppedImage.Width = 200;
croppedImage.Margin = new Thickness(5);

// Create a CroppedBitmap based off of a xaml defined resource.
CroppedBitmap cb = new CroppedBitmap(     
   (BitmapSource)this.Resources["masterImage"],
   new Int32Rect(30, 20, 105, 50));       //select region rect
croppedImage.Source = cb;                 //set image source to cropped

CroppedBitmap 还可以用作另一个 CroppedBitmap 的源,从而链接裁剪内容。请注意,SourceRect 使用相对于源裁剪位图的值,而不是使用相对于初始图像的值。