Exemplo n.º 1
0
        static private Image GetBitmapFromResource(Type t, string bitmapname, bool large)
        {
            if (bitmapname == null)
            {
                return(null);
            }

            Image img = null;

            // load the image from the manifest resources.
            //
            Stream stream = BitmapSelector.GetResourceStream(t, bitmapname);

            if (stream != null)
            {
                Bitmap b = new Bitmap(stream);
                img = b;
                MakeBackgroundAlphaZero(b);
                if (large)
                {
                    img = new Bitmap(b, largeSize.Width, largeSize.Height);
                }
                if (DpiHelper.IsScalingRequired)
                {
                    b = (Bitmap)img;
                    DpiHelper.ScaleBitmapLogicalToDevice(ref b);
                    img = b;
                }
            }
            return(img);
        }
Exemplo n.º 2
0
        static private Image GetBitmapFromResource(Type t, string bitmapname, bool large)
        {
            if (bitmapname == null)
            {
                return(null);
            }

            Image img = null;

            // load the image from the manifest resources.
            //
            Stream stream = BitmapSelector.GetResourceStream(t, bitmapname);

            if (stream != null)
            {
                Bitmap b = new Bitmap(stream);
                img = b;
                MakeBackgroundAlphaZero(b);
                if (large)
                {
                    img = new Bitmap(b, largeDim.X, largeDim.Y);
                }
            }
            return(img);
        }
Exemplo n.º 3
0
        static private Image GetIconFromResource(Type t, string bitmapname, bool large)
        {
            if (bitmapname == null)
            {
                return(null);
            }

            return(GetIconFromStream(BitmapSelector.GetResourceStream(t, bitmapname), large));
        }
Exemplo n.º 4
0
        private static Image?GetIconFromResource(Type t, string?bitmapname, bool large, bool scaled)
        {
            if (bitmapname == null)
            {
                return(null);
            }

            return(GetIconFromStream(BitmapSelector.GetResourceStream(t, bitmapname), large, scaled));
        }
Exemplo n.º 5
0
        static ToolboxBitmapAttribute()
        {
            // When we call Gdip.DummyFunction, JIT will make sure Gdip..cctor will be called.
            SafeNativeMethods.Gdip.DummyFunction();

            Stream stream = BitmapSelector.GetResourceStream(typeof(ToolboxBitmapAttribute), "DefaultComponent.bmp");

            Debug.Assert(stream != null, "DefaultComponent.bmp must be present as an embedded resource.");

            var bitmap = new Bitmap(stream);

            MakeBackgroundAlphaZero(bitmap);
            s_defaultComponent = new ToolboxBitmapAttribute(bitmap, null);
        }
Exemplo n.º 6
0
        static ToolboxBitmapAttribute()
        {
            //Fix for Dev10 560430. When we call Gdip.DummyFunction, JIT will make sure Gdip..cctor will be called before
            SafeNativeMethods.Gdip.DummyFunction();

            Bitmap bitmap = null;
            Stream stream = BitmapSelector.GetResourceStream(typeof(ToolboxBitmapAttribute), "DefaultComponent.bmp");

            if (stream != null)
            {
                bitmap = new Bitmap(stream);
                MakeBackgroundAlphaZero(bitmap);
            }
            DefaultComponent = new ToolboxBitmapAttribute(bitmap, null);
        }
Exemplo n.º 7
0
        static ToolboxBitmapAttribute()
        {
            // Ensure Gdip type initializer has run.
            SafeNativeMethods.Gdip.DummyFunction();

            Bitmap bitmap = null;
            Stream stream = BitmapSelector.GetResourceStream(typeof(ToolboxBitmapAttribute), "DefaultComponent.bmp");

            if (stream != null)
            {
                bitmap = new Bitmap(stream);
                MakeBackgroundAlphaZero(bitmap);
            }
            s_defaultComponent = new ToolboxBitmapAttribute(bitmap, null);
        }