2
* Xibo - Digitial Signage - http://www.xibo.org.uk
3
* Copyright (C) 2006,2007,2008 Daniel Garner and James Packer
5
* This file is part of Xibo.
7
* Xibo is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU Affero General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
12
* Xibo is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU Affero General Public License for more details.
17
* You should have received a copy of the GNU Affero General Public License
18
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
21
using System.Collections.Generic;
24
using System.Windows.Forms;
28
class ImagePosition : Media
30
private string _filePath;
31
PictureBox _pictureBox;
33
public ImagePosition(RegionOptions options)
34
: base(options.width, options.height, options.top, options.left)
36
_filePath = options.uri;
38
if (!System.IO.File.Exists(_filePath))
41
System.Diagnostics.Trace.WriteLine(new LogMessage("Image - Dispose", "Cannot Create image object. Invalid Filepath."), LogType.Error.ToString());
47
_pictureBox = new PictureBox();
48
_pictureBox.SizeMode = PictureBoxSizeMode.Zoom;
49
_pictureBox.Image = new Bitmap(_filePath);
50
_pictureBox.Size = new Size(width, height);
51
_pictureBox.Location = new Point(0, 0);
52
_pictureBox.BorderStyle = BorderStyle.None;
53
_pictureBox.BackColor = Color.Transparent;
55
this.Controls.Add(this._pictureBox);
59
System.Diagnostics.Trace.WriteLine(new LogMessage("ImagePosition", String.Format("Cannot create Image Object with exception: {0}", ex.Message)), LogType.Error.ToString());
63
public override void RenderMedia()
68
protected override void Dispose(bool disposing)
74
Controls.Remove(_pictureBox);
76
_pictureBox.Image.Dispose();
77
_pictureBox.Dispose();
81
System.Diagnostics.Trace.WriteLine(new LogMessage("Image - Dispose", String.Format("Cannot dispose Image Object with exception: {0}", ex.Message)), LogType.Error.ToString());
85
base.Dispose(disposing);