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

推荐订阅源

WordPress大学
WordPress大学
T
Threatpost
阮一峰的网络日志
阮一峰的网络日志
美团技术团队
F
Fortinet All Blogs
The GitHub Blog
The GitHub Blog
月光博客
月光博客
V
Visual Studio Blog
T
Tailwind CSS Blog
Stack Overflow Blog
Stack Overflow Blog
博客园 - 聂微东
Jina AI
Jina AI
J
Java Code Geeks
Martin Fowler
Martin Fowler
大猫的无限游戏
大猫的无限游戏
Recorded Future
Recorded Future
C
Check Point Blog
腾讯CDC
N
Netflix TechBlog - Medium
aimingoo的专栏
aimingoo的专栏
罗磊的独立博客
Hacker News: Ask HN
Hacker News: Ask HN
SecWiki News
SecWiki News
博客园 - Franky
Hacker News - Newest:
Hacker News - Newest: "LLM"
N
News | PayPal Newsroom
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security @ Cisco Blogs
W
WeLiveSecurity
The Last Watchdog
The Last Watchdog
Cloudbric
Cloudbric
F
Full Disclosure
The Cloudflare Blog
Y
Y Combinator Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
S
Schneier on Security
Schneier on Security
Schneier on Security
Spread Privacy
Spread Privacy
L
LINUX DO - 热门话题
AI
AI
N
News and Events Feed by Topic
T
Tor Project blog
P
Palo Alto Networks Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
G
Google Developers Blog

博客园 - amey

不错的blog 系统内置的图片资源---android.R.drawable android 开发不容错过的网站 Android风格与主题(style and theme) Android中的长度单位详解 startActivity 出错 main cannot be resolved or is not a field Android DDMS如何使用? 网上绝无仅有的Log分析教程及例子(转) 如何控制Android不锁屏 Android系统名词解释汇总 - Android讨论区::91手机论坛-91手机娱乐门户 Android开发中的drawable-(hdpi,mdpi,ldpi)和WVGA,HVGA,QVGA的区别以及联系 每一位想有所成就的程序员都必须知道的15件事(转载) MSDN一篇很好的WCF入门教程(转) 使用Refactor找回被覆盖的代码 第一次制作.hlp文件格式的帮助文档 windows应用程序名要与配置文件命名一致 如何控制静态Form类与普通的Form类之间的切换 [windows编程]error C2664: “MessageBoxW”: 不能将参数 2 从“char *”转换为“LPCWSTR” - amey
GetManifestResourceStream的使用
amey · 2011-02-11 · via 博客园 - amey

VB.Net中资源的名称为:项目默认命名空间.资源文件名

C#中则是:项目命名空间.资源文件所在文件夹名.资源文件名

例:
[C# code]
Assembly assm = this.GetType().Assembly.GetExecutingAssembly();
istr = assm.GetManifestResourceStream("项目命名空间.资源文件所在文件夹名.资源文件名");

eg:

 public Bitmap LoadBitmap(string imageName, int width, int height)
        {
            return LoadBitmap(this.GetType().Assembly.GetManifestResourceStream("Sample.Images." + imageName + ScreenFactorSuffix + ".png"), width, height);
        }

        public Bitmap LoadBitmap(Stream s, int width, int height)
        {
            Bitmap dib = new Bitmap(s);
            Bitmap ddb = new Bitmap(width * ScreenFactor, height * ScreenFactor);
            Graphics g = Graphics.FromImage(ddb);
            g.DrawImage(dib, new Rectangle(0, 0, width * ScreenFactor, height * ScreenFactor), new Rectangle(0, 0, dib.Width, dib.Height), GraphicsUnit.Pixel);
            dib.Dispose();
            return ddb;
        }