aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/SideChains/RealTimeGraphEx/Models/RealTimeGraphExColumn.cs
blob: 2a328a2fa440f3a1c81758201606500fb9311d27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RealTimeGraphEx.Models
{
    public class RealTimeGraphExColumn
    {
        public RealTimeGraphExColumn(int x, int y, int right, int bottom)
        {
            X = x;
            Y = y;
            Right = right;
            Bottom = bottom;
        }

        public int X { get; set; }
        public int Y { get; set; }
        public int Right { get; set; }
        public int Bottom { get; set; }
    }
}
p">.Drawing.Bitmap(stream)) { // According to MSDN, one "must keep the stream open for the lifetime of the Bitmap." // So we return a copy of the new bitmap, allowing us to dispose both the bitmap and the stream. var result = new System.Drawing.Bitmap(tempBitmap); stream.Dispose(); return result; } } } /// <summary> /// Convert the WriteableBitmap to BitmapImage. /// </summary> /// <param name="bitmapSource">The writeable bitmap.</param> /// <returns>returns a new instance of BitmapImage</returns> public static BitmapImage ConvertToBitmapImage(this WriteableBitmap bitmapSource) { JpegBitmapEncoder encoder = new JpegBitmapEncoder(); MemoryStream memoryStream = new MemoryStream(); BitmapImage bImg = new BitmapImage(); encoder.Frames.Add(BitmapFrame.Create(bitmapSource)); encoder.Save(memoryStream); bImg.BeginInit(); bImg.StreamSource = new MemoryStream(memoryStream.ToArray()); bImg.EndInit(); memoryStream.Close(); return bImg; } }