Skip to content

Commit

Permalink
Owner draw image link label for mono compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
glopesdev committed Jan 20, 2025
1 parent b7d08db commit 85145b0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
17 changes: 17 additions & 0 deletions Bonsai.NuGet.Design/ImageLinkLabel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,22 @@ public override Size GetPreferredSize(Size proposedSize)
}
return size;
}

protected override void OnPaint(PaintEventArgs e)
{
var rectangle = ClientRectangle;
base.OnPaintBackground(e);
if (Image != null)
{
var imageBounds = CalcImageRenderBounds(Image, rectangle, ImageAlign);
if (NativeMethods.IsRunningOnMono)
e.Graphics.DrawImage(Image, imageBounds.Location);
else
rectangle.X -= imageBounds.X;
rectangle.X += imageBounds.Width;
}

TextRenderer.DrawText(e.Graphics, Text, Font, rectangle, LinkColor);
}
}
}
18 changes: 9 additions & 9 deletions Bonsai.NuGet.Design/PackageDetails.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 85145b0

Please sign in to comment.