Beispiel #1
0
        public Bitmap GetBitmap()
        {
            LoadAnimation();
            Bitmap frame = animationConverter.GetNextFrame();

            if (frame != null)
            {
                if (frame.Size.Width > maxSize.Width || frame.Size.Height > maxSize.Height)
                {
                    bitmap = new Bitmap(MaxSize.Width, MaxSize.Height);
                    Graphics g = Graphics.FromImage(bitmap);
                    g.DrawImage(frame, new Rectangle(0, 0, MaxSize.Width, MaxSize.Height));
                }
                else
                {
                    bitmap = frame;
                }
            }
            else if (bitmap == null)
            {
                Size tempSize = new Size(5, 5);
                bitmap = new Bitmap(tempSize.Width, tempSize.Height);
                Graphics g   = Graphics.FromImage(bitmap);
                Pen      pen = new Pen(Color.Blue, 1);
                tempSize.Height--;
                tempSize.Width--;
                Rectangle rect = new Rectangle(new Point(0, 0), tempSize);
                g.DrawRectangle(pen, rect);
            }
            size = bitmap.Size;
            return(bitmap);
        }