public override void Draw(IDrawingGraphics drawingGraphics)
 {
     if (m_pressed)
     {
         drawingGraphics.DrawAlphaImage(this.image, 2, 2, Size.Width - 4, Size.Height - 4);
     }
     else
     {
         drawingGraphics.DrawAlphaImage(this.image, 0, 0, Size.Width, Size.Height);
     }
 }
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            if (_image == null) return;

            switch (StretchType)
            {
                case StretchTypeOptions.None:
                    drawingGraphics.DrawAlphaImage(_image, 0, 0);
                    break;
                case StretchTypeOptions.Fill:
                    drawingGraphics.DrawAlphaImage(_image, 0, 0, Size.Width, Size.Height);
                    break;
                case StretchTypeOptions.Proportional:
                    var scaleX = 1.0 * Size.Width / _image.Size.Width;
                    var scaleY = 1.0 * Size.Height / _image.Size.Height;
                    var scale = Math.Min(1, Math.Min(scaleX, scaleY));
                    drawingGraphics.DrawAlphaImage(_image, 0, 0, (int)Math.Round(_image.Size.Width * scale), (int)Math.Round(_image.Size.Height * scale));
                    break;
            }
        }
Example #3
0
        public void DrawScrollBar(IDrawingGraphics drawingGr)
        {
            drawingGr.DrawAlphaImage("verticalscrollbar.png", new Rectangle(this.Size.Width - this.ScrollBarWidth, 0, this.ScrollBarWidth, this.Size.Height));
            var scrollHeight = 0;
            var scrollBegin  = 0;

            if (this.Content.Size.Height != 0)
            {
                scrollHeight = Math.Max(this.Size.Height * this.Size.Height / this.Content.Size.Height, 20);
                scrollBegin  = this.Size.Height * -this.VerticalOffset / this.Content.Size.Height;
            }
            drawingGr.Color(this.ScrollBarColor).FillRectangle(new Rectangle(this.Size.Width - this.ScrollBarWidth, scrollBegin, this.ScrollBarWidth, scrollHeight));
        }
Example #4
0
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            var size = Size;
            var trect = new Rectangle(0,0, size.Width, size.Height);

            if (image == null)
                return;

            if (KeepAspect)
            {
                double scale = (double)ImageSize.Width / ImageSize.Height;
                size = new Size(Size.Width, (int)(Size.Width / scale));
                if (size.Height > Size.Height)
                    size = new Size((int)(Size.Height * scale), Size.Height);
                trect = new Rectangle((Size.Width - size.Width)/2,
                                     (Size.Height - size.Height)/2,
                                     size.Width, size.Height);
            }
            drawingGraphics.DrawAlphaImage(this.image, trect);
        }
 public override void Draw(IDrawingGraphics drawingGraphics)
 {
     drawingGraphics.DrawAlphaImage(this.image, 0, 0, Size.Width, Size.Height);
 }
Example #6
0
 public void DrawScrollBar(IDrawingGraphics drawingGr)
 {
     drawingGr.DrawAlphaImage("verticalscrollbar.png", new Rectangle(this.Size.Width - this.ScrollBarWidth, 0, this.ScrollBarWidth, this.Size.Height));
     var scrollHeight = 0;
     var scrollBegin = 0;
     if (this.Content.Size.Height != 0)
     {
         scrollHeight = Math.Max(this.Size.Height * this.Size.Height / this.Content.Size.Height, 20);
         scrollBegin = this.Size.Height * -this.VerticalOffset / this.Content.Size.Height;
     }
     drawingGr.Color(this.ScrollBarColor).FillRectangle(new Rectangle(this.Size.Width - this.ScrollBarWidth, scrollBegin, this.ScrollBarWidth, scrollHeight));
 }
 public override void Draw(IDrawingGraphics drawingGraphics)
 {
     drawingGraphics.DrawAlphaImage(this.image, 0, 0, Size.Width, Size.Height);
 }
Example #8
0
 protected void DoDrawShadows(IDrawingGraphics drawingGraphics)
 {
     if (this.VerticalOffset < 0)
     {
         drawingGraphics.DrawAlphaImage("top.png",
                                        new Rectangle(0, 0, this.Size.Width, 15));
     }
     if (this.VerticalOffset > Math.Min(0, -this.Content.Size.Height + this.Size.Height))
     {
         drawingGraphics.DrawAlphaImage("bottom.png",
                                        new Rectangle(0, this.Size.Height - 15, this.Size.Width, 15));
     }
 }