Ejemplo n.º 1
0
        protected void DrawBackgroundImage(PaintEventArgs e, int alpha, string suffix)
        {
            int width = Convert.ToInt32(Math.Ceiling(Width / 16f) * 16);

            using (Bitmap image = (Bitmap)GUIUtilities.VariableSizeImageRoundButton(BackgroundImagePrefix + suffix, "", width))
            {
                if (image == null)
                {
                    if (!this.DesignMode)
                    {
                        Utilities.LogSubError("RoundButton::DrawBackgroundImage failed to load image for suffix = " + suffix);
                    }
                    return;
                }
                if (alpha == 255)
                {
                    e.Graphics.DrawImage(image, new Rectangle(0, 0, Width, Height), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel);
                }
                else
                {
                    using (System.Drawing.Imaging.ImageAttributes objAttr = GUIUtilities.GetImageAttrForAlpha(alpha))
                    {
                        e.Graphics.DrawImage(image, new Rectangle(0, 0, Width, Height), objAttr);
                    }
                }
            }
        }