aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Frontend/GUI/PictureBox.cs
diff options
context:
space:
mode:
Diffstat (limited to 'ShiftOS.Frontend/GUI/PictureBox.cs')
-rw-r--r--ShiftOS.Frontend/GUI/PictureBox.cs15
1 files changed, 13 insertions, 2 deletions
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