Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

Using Embedded Resources - .Net Framework

RSS
Modified on Sun, Nov 30, 2008, 2:00 AM by Administrator Categorized as ┬ĚNet Framework
Here are the steps to using a file as an embedded resource.

  1. Include the file in your project
  2. In the Properties Window, set the Build Action property to Embedded Resource.
  3. To use the embedded resource in code, use the following example. You can convert code between C# and VB.NET at this website.

Image

namespace Maestro.SongUi
{
    internal class Common
    {
        public static Cursor GetLineSelectionCursor()
        {
            Cursor result = null;
            /*                     v-- Namespace
             *                     v              v-- folder name
             */                    v              v         v-- file name --v
            string resourceName = "Maestro.SongUi.Resources.SelectTextLine.cur";
            Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName);

            if (s != null)
                result = new Cursor(s);

            return result;
        }
    }
}

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2018, Patrick Jasinski.