CSharpGL.ManifestResourceLoader.LoadBitmap C# (CSharp) Method

LoadBitmap() public static method

Loads bitmap in the manifest resource.
public static LoadBitmap ( string filename, int stackIndex = 2 ) : Bitmap
filename string
stackIndex int
return System.Drawing.Bitmap
        public static Bitmap LoadBitmap(string filename, int stackIndex = 2)
        {
            Assembly executingAssembly;
            string location;
            GetLocation(filename, stackIndex, out executingAssembly, out location);

            using (Stream stream = executingAssembly.GetManifestResourceStream(location))
            {
                Image image = Bitmap.FromStream(stream);
                Bitmap bmp = image as Bitmap;
                return bmp;
            }
        }

Usage Example

Ejemplo n.º 1
0
        protected override void DoInitialize()
        {
            base.DoInitialize();

            Bitmap bitmap;

            if (string.IsNullOrEmpty(this.bitmapFilename))// display a cursor as default.
            {
                bitmap = ManifestResourceLoader.LoadBitmap(@"Resources\cursor_gold.png");
            }
            else
            {
                bitmap = new Bitmap(this.bitmapFilename);
            }
            var texture = new Texture(TextureTarget.Texture2D, bitmap, new SamplerParameters());

            texture.Initialize();
            bitmap.Dispose();
            this.SetUniform("tex", texture);
        }
All Usage Examples Of CSharpGL.ManifestResourceLoader::LoadBitmap