Call the embedded resource

xiaoxiao2021-03-06  130

Embedded resources

---------------------

TYPE T = this.gettype ();

Icon icon = new icon (t, "iconname.ico");

---------------------

Right click Resource Manager - Add an existing project (add a JPG picture called 123)

Select the picture, set "Generate" to "embedded resources" in the properties column

Code:

System.Reflection.Assembly thisexe; thisexe = system.reflection.Assembly.GetexecutingAssembly ();

// WindowsApplication1 is the namespace of the assembly //123.jpg for the image system.io.stream file = thisexe.getManifestResourceStream ("WindowsApplication1.123.jpg");

This.PictureBox1.Image = image.fromstream (file);

转载请注明原文地址:https://www.9cbs.com/read-126732.html

New Post(0)