Skip to content

Commit

Permalink
Source changes to handle Bitmap to Icon changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
dreddy-work authored and RussKie committed Jun 25, 2019
1 parent 0448add commit e8e3ac9
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
</EmbeddedResource>
<EmbeddedResource Include="Resources\System\WinForms\Design\professional1.ico">
<LogicalName>System.Windows.Forms.Design.professional1</LogicalName>
<Link>System.Windows.Forms.Design.professional1.bmp</Link>
</EmbeddedResource>
<EmbeddedResource Include="Resources\System\WinForms\Design\professional2.ico">
<LogicalName>System.Windows.Forms.Design.professional2</LogicalName>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ private Bitmap MoveGlyph
{
if (_glyph == null)
{
_glyph = new Bitmap(typeof(ContainerSelectorGlyph), "MoverGlyph.bmp");
_glyph.MakeTransparent();
_glyph = new Icon(typeof(ContainerSelectorGlyph), "MoverGlyph").ToBitmap();
}
return _glyph;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ private Image GlyphImageClosed
{
if (_glyphImageClosed == null)
{
_glyphImageClosed = new Bitmap(typeof(DesignerActionGlyph), "Close_left.bmp");
_glyphImageClosed.MakeTransparent(Color.Magenta);
_glyphImageClosed = new Icon(typeof(DesignerActionGlyph), "Close_left").ToBitmap();

if (DpiHelper.IsScalingRequired)
{
DpiHelper.ScaleBitmapLogicalToDevice(ref _glyphImageClosed);
Expand All @@ -111,8 +111,8 @@ private Image GlyphImageOpened
{
if (_glyphImageOpened == null)
{
_glyphImageOpened = new Bitmap(typeof(DesignerActionGlyph), "Open_left.bmp");
_glyphImageOpened.MakeTransparent(Color.Magenta);
_glyphImageOpened = new Icon(typeof(DesignerActionGlyph), "Open_left").ToBitmap();

if (DpiHelper.IsScalingRequired)
{
DpiHelper.ScaleBitmapLogicalToDevice(ref _glyphImageOpened);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public Bitmap InheritanceGlyph
{
if (s_inheritanceGlyph == null)
{
s_inheritanceGlyph = new Bitmap(typeof(InheritanceUI), "InheritedGlyph.bmp");
s_inheritanceGlyph.MakeTransparent();
s_inheritanceGlyph = new Icon(typeof(InheritanceUI), "InheritedGlyph").ToBitmap();

if (DpiHelper.IsScalingRequired)
{
DpiHelper.ScaleBitmapLogicalToDevice(ref s_inheritanceGlyph);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public override Image Image
{
if (_name != null)
{
_image = new Icon(typeof(ToolStripMenuItem), _name + ".bmp").ToBitmap();
_image = new Icon(typeof(ToolStripMenuItem), _name).ToBitmap();
}
ImageTransparentColor = Color.Magenta;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,39 +416,39 @@ private Bitmap GetImage(string name)
Bitmap image = null;
if (name.StartsWith("new"))
{
image = new Bitmap(typeof(ToolStripMenuItem), "new.bmp");
image = new Icon(typeof(ToolStripMenuItem), "new").ToBitmap();
}
else if (name.StartsWith("open"))
{
image = new Bitmap(typeof(ToolStripMenuItem), "open.bmp");
image = new Icon(typeof(ToolStripMenuItem), "open").ToBitmap();
}
else if (name.StartsWith("save"))
{
image = new Bitmap(typeof(ToolStripMenuItem), "save.bmp");
image = new Icon(typeof(ToolStripMenuItem), "save").ToBitmap();
}
else if (name.StartsWith("printPreview"))
{
image = new Bitmap(typeof(ToolStripMenuItem), "printPreview.bmp");
image = new Icon(typeof(ToolStripMenuItem), "printPreview").ToBitmap();
}
else if (name.StartsWith("print"))
{
image = new Bitmap(typeof(ToolStripMenuItem), "print.bmp");
image = new Icon(typeof(ToolStripMenuItem), "print").ToBitmap();
}
else if (name.StartsWith("cut"))
{
image = new Bitmap(typeof(ToolStripMenuItem), "cut.bmp");
image = new Icon(typeof(ToolStripMenuItem), "cut").ToBitmap();
}
else if (name.StartsWith("copy"))
{
image = new Bitmap(typeof(ToolStripMenuItem), "copy.bmp");
image = new Icon(typeof(ToolStripMenuItem), "copy").ToBitmap();
}
else if (name.StartsWith("paste"))
{
image = new Bitmap(typeof(ToolStripMenuItem), "paste.bmp");
image = new Icon(typeof(ToolStripMenuItem), "paste").ToBitmap();
}
else if (name.StartsWith("help"))
{
image = new Bitmap(typeof(ToolStripMenuItem), "help.bmp");
image = new Icon(typeof(ToolStripMenuItem), "help").ToBitmap();
}
return image;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private void InsertToolStripItem(Type t)
Image image = null;
try
{
image = new Bitmap(typeof(ToolStripButton), "blank.bmp");
image = new Icon(typeof(ToolStripButton), "blank").ToBitmap();
}
catch (Exception e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ internal ToolStripItem AddNewItem(Type t, string text, bool enterKeyPressed, boo
Image image = null;
try
{
image = new Bitmap(typeof(ToolStripButton), "blank.bmp");
image = new Icon(typeof(ToolStripButton), "blank").ToBitmap();
}
catch (Exception e)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

Expand Down Expand Up @@ -121,7 +121,7 @@ private void PopulateList()
imageToolStripMenuItem = new ToolStripMenuItem
{
Text = SR.ToolStripItemContextMenuSetImage,
Image = new Bitmap(typeof(ToolStripMenuItem), "image.bmp"),
Image = new Icon(typeof(ToolStripMenuItem), "image").ToBitmap(),
ImageTransparentColor = Color.Magenta
};
//Add event Handlers
Expand Down Expand Up @@ -155,10 +155,10 @@ private void PopulateList()
imageStyleToolStripMenuItem = CreateEnumValueItem("DisplayStyle", "Image", ToolStripItemDisplayStyle.Image);
imageTextStyleToolStripMenuItem = CreateEnumValueItem("DisplayStyle", "ImageAndText", ToolStripItemDisplayStyle.ImageAndText);
// alignmentToolStripMenuItem
alignmentToolStripMenuItem = CreatePropertyBasedItem("Ali&gnment", "Alignment", "alignment.bmp");
alignmentToolStripMenuItem = CreatePropertyBasedItem("Ali&gnment", "Alignment", "alignment");
alignmentToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { leftToolStripMenuItem, rightToolStripMenuItem });
// displayStyleToolStripMenuItem
displayStyleToolStripMenuItem = CreatePropertyBasedItem("Displa&yStyle", "DisplayStyle", "displaystyle.bmp");
displayStyleToolStripMenuItem = CreatePropertyBasedItem("Displa&yStyle", "DisplayStyle", "displaystyle");
displayStyleToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { noneStyleToolStripMenuItem, textStyleToolStripMenuItem, imageStyleToolStripMenuItem, imageTextStyleToolStripMenuItem });

if (serviceProvider.GetService(typeof(IUIService)) is IUIService uis)
Expand Down Expand Up @@ -212,7 +212,7 @@ private void PopulateList()
Text = SR.ToolStripDropDownItemCollectionEditorVerb
};
editItemsToolStripMenuItem.Click += new EventHandler(OnEditItemsMenuItemClick);
editItemsToolStripMenuItem.Image = new Icon(typeof(ToolStripMenuItem), "editdropdownlist.bmp").ToBitmap();
editItemsToolStripMenuItem.Image = new Icon(typeof(ToolStripMenuItem), "editdropdownlist").ToBitmap();
editItemsToolStripMenuItem.ImageTransparentColor = Color.Magenta;
Add(editItemsToolStripMenuItem);
}
Expand Down Expand Up @@ -553,7 +553,7 @@ private void InsertToolStripItem(Type t)
Image image = null;
try
{
image = new Bitmap(typeof(ToolStripButton), "blank.bmp");
image = new Icon(typeof(ToolStripButton), "blank").ToBitmap();
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ internal virtual ToolStripItem MorphCurrentItem(Type t)
Image image = null;
try
{
image = new Bitmap(typeof(ToolStripButton), "blank.bmp");
image = new Icon(typeof(ToolStripButton), "blank").ToBitmap();
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1395,10 +1395,9 @@ private void SetUpToolTemplateNode(ToolStripTemplateNode owner, string text, Ima
{
ItemTypeToolStripMenuItem firstItem = (ItemTypeToolStripMenuItem)_addItemButton.DropDownItems[0];
_addItemButton.ImageTransparentColor = Color.Lime;
Bitmap bmp = new Bitmap(typeof(ToolStripTemplateNode), "ToolStripTemplateNode.bmp");
Bitmap bmp = new Icon(typeof(ToolStripTemplateNode), "ToolStripTemplateNode").ToBitmap();
if (DpiHelper.IsScalingRequired)
{
bmp.MakeTransparent(Color.Lime);
DpiHelper.ScaleBitmapLogicalToDevice(ref bmp);
}
_addItemButton.Image = bmp;
Expand Down

0 comments on commit e8e3ac9

Please sign in to comment.