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); }
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); }
static private Image GetIconFromResource(Type t, string bitmapname, bool large) { if (bitmapname == null) { return(null); } return(GetIconFromStream(BitmapSelector.GetResourceStream(t, bitmapname), large)); }
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)); }
// Cache the last result of BitmapSelector.GetFileName because we commonly load images twice // in succession from the same file and we don't need to compute the name twice. private static string GetFileNameFromBitmapSelector(string originalName) { if (originalName != lastOriginalFileName) { lastOriginalFileName = originalName; lastUpdatedFileName = BitmapSelector.GetFileName(originalName); } return(lastUpdatedFileName); }
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); }
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); }
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); }