From de9bc8567b268e9659d174f65ce7dc23dff6fafe Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 5 Jul 2017 13:15:00 -0400 Subject: experimental stuff --- ShiftOS.Frontend/GUI/PictureBox.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'ShiftOS.Frontend/GUI/PictureBox.cs') diff --git a/ShiftOS.Frontend/GUI/PictureBox.cs b/ShiftOS.Frontend/GUI/PictureBox.cs index 91735aa..6f60b29 100644 --- a/ShiftOS.Frontend/GUI/PictureBox.cs +++ b/ShiftOS.Frontend/GUI/PictureBox.cs @@ -8,12 +8,13 @@ using System.Threading.Tasks; using ShiftOS.Engine; using System.Drawing.Imaging; using ShiftOS.Frontend.GraphicsSubsystem; +using Microsoft.Xna.Framework.Graphics; namespace ShiftOS.Frontend.GUI { public class PictureBox : Control { - private System.Drawing.Image img = null; + private Texture2D img = null; private ImageLayout _layout = ImageLayout.Fit; public ImageLayout ImageLayout @@ -28,7 +29,7 @@ namespace ShiftOS.Frontend.GUI } } - public System.Drawing.Image Image + public Texture2D Image { get { @@ -53,6 +54,16 @@ namespace ShiftOS.Frontend.GUI protected override void OnPaint(GraphicsContext gfx) { + switch (_layout) + { + case ImageLayout.Stretch: + gfx.DrawRectangle(0, 0, Width, Height, Image); + break; + case ImageLayout.None: + gfx.DrawRectangle(0, 0, Image.Width, Image.Height, Image); + break; + } + } //Again, thanks StackOverflow -- cgit v1.2.3