Skip to content

Commit

Permalink
Update the logic of the function GetIconResourceAsBitmap in class Sca… (
Browse files Browse the repository at this point in the history
dotnet#10459)

Using function "GetIconResourceAsBitmap(Type type, string resource, Size size)" instead of "GetIconResourceAsBitmap(Type type, string resource, int dpi)" when initial Image "GlyphImageClosed" and "GlyphImageOpened" becasue these images are smaller than the standard size, they are 10x10. We need this custom size to scale them correctly.
  • Loading branch information
LeafShi1 authored Dec 21, 2023
1 parent be7220a commit 4634f59
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ internal sealed class DesignerActionGlyph : Glyph
internal const int CONTROLOVERLAP_X = 5; // number of pixels the anchor should be offset to the left of the control's upper-right
internal const int CONTROLOVERLAP_Y = 2; // number of pixels the anchor overlaps the control in the y-direction

private const byte IconSize = 10;
private Rectangle _alternativeBounds = Rectangle.Empty; // if !empty, this represents the bounds of the tray control this glyph is related to
private Rectangle _bounds; // the bounds of our glyph
private readonly Adorner? _adorner; // A ptr back to our adorner - so when we decide to change state, we can invalidate
Expand Down Expand Up @@ -98,12 +99,12 @@ public bool IsInComponentTray
private Image GlyphImageClosed => _glyphImageClosed ??= ScaleHelper.GetIconResourceAsBitmap(
typeof(DesignerActionGlyph),
"Close_left",
ScaleHelper.InitialSystemDpi);
ScaleHelper.ScaleToDpi(new Size(IconSize, IconSize), ScaleHelper.InitialSystemDpi));

private Image GlyphImageOpened => _glyphImageOpened ??= ScaleHelper.GetIconResourceAsBitmap(
typeof(DesignerActionGlyph),
"Open_left",
ScaleHelper.InitialSystemDpi);
ScaleHelper.ScaleToDpi(new Size(IconSize, IconSize), ScaleHelper.InitialSystemDpi));

internal void InvalidateOwnerLocation()
{
Expand Down

0 comments on commit 4634f59

Please sign in to comment.