开发者

Create a Icon from a Resources.resx

开发者 https://www.devze.com 2022-12-18 19:58 出处:网络
I have 开发者_StackOverflowa Icon(.ico file) in the (VB.NET)MyProject>Resources.resx file. How do I extract it in run-time as a Icon object?

I have 开发者_StackOverflowa Icon(.ico file) in the (VB.NET)MyProject>Resources.resx file.

How do I extract it in run-time as a Icon object?

Thanks


You should be able to do the following:

Dim myIcon as Icon = [Your Project Namespace].Properties.Resources.[icon name]

It should pop up with Intellisense.

NOTE: My VB is a bit rusty and I've been using VS 2008 for quite some time, so my apologies if this isn't quite right in syntax or not the way to do it in VS 2005.

UPDATE: Apparently the VB way of accessing [Your Project NameSpace].Properties is to use the My keyword:

Dim myIcon as Icon = My.Properties.[icon name]


Your icon will show up with intellisense under My.Resources as in:

My.Resources.<name of icon>
0

精彩评论

暂无评论...
验证码 换一张
取 消