using System.Drawing; namespace DevComponents.DotNetBar.SuperGrid { /// /// CheckDisplay /// static public class ExpandDisplay { #region RenderButton /// /// RenderButton /// /// /// /// /// static public Size RenderButton(Graphics g, Image image, Rectangle buttonBounds, Rectangle clipBounds) { if (image != null && buttonBounds.IsEmpty == false) { Rectangle r = buttonBounds; r.Width++; r.Height++; Size isize = Dpi.Size(image.Size); if (r.Width > isize.Width) { r.X += (r.Width - isize.Width) / 2; r.Width = isize.Width; } if (r.Height > isize.Height) { r.Y += (r.Height - isize.Height) / 2; r.Height = isize.Height; } r.Intersect(clipBounds); g.DrawImageUnscaledAndClipped(image, r); return (r.Size); } return (Size.Empty); } #endregion } }