BrightIdeasSoftware.ObjectListView.MakeResizedImage C# (CSharp) Méthode

MakeResizedImage() private méthode

Return a bitmap of the given height x height, which shows the given image, centred.
private MakeResizedImage ( int width, int height, Image image, Color transparent ) : Bitmap
width int Height and width of new bitmap
height int Height and width of new bitmap
image Image Image to be centred
transparent Color The background color
Résultat Bitmap
        private Bitmap MakeResizedImage(int width, int height, Image image, Color transparent)
        {
            Bitmap bm = new Bitmap(width, height);
            Graphics g = Graphics.FromImage(bm);
            g.Clear(transparent);
            int x = Math.Max(0, (bm.Size.Width - image.Size.Width) / 2);
            int y = Math.Max(0, (bm.Size.Height - image.Size.Height) / 2);
            g.DrawImage(image, x, y, image.Size.Width, image.Size.Height);
            return bm;
        }
ObjectListView