|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace SprinterPublishing
{
public partial class ImageFrame : UserControl
{
private double scale = 1.0;
Color c;
public ImageFrame()
{
InitializeComponent();
this.label.Text = String.Empty;
this.pictureBox.Image = null;
scale = 1.0;
c = Color.LightGray;
}
public ImageFrame( Color backColor, double scale )
{
InitializeComponent();
this.label.Text = String.Empty;
this.pictureBox.Image = null;
this.scale = scale;
c = backColor;
}
public Color BackgroundColor
{
set
{
pictureBox.BackColor = value;
c = value;
}
}
public void Clear()
{
this.Hide();
}
public double ImageScale
{
get { return scale; }
set { scale = value; Frame = pictureBox.Image; }
}
public Image Frame
{
get
{
return pictureBox.Image;
}
set
{
pictureBox.Image = null;
pictureBox.BackColor = c;
pictureBox.Image = value;
if (value != null)
{
this.Size = new Size( (int)(value.Size.Width * scale),
(int)(value.Size.Height * scale + label.Height) );
pictureBox.Size = new Size( (int)( value.Size.Width * scale ),
(int)(value.Size.Height * scale) );
this.Show();
}
else
{
this.Hide();
}
}
}
public string Label
{
get
{
return label.Text;
}
set
{
label.Text = value;
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I've been software developer since early 1991. My focuses have ranged from deeply embedded (Intel and ARM architectures,) to firmware (C and C++), to application level software under Linux and Windows (C, C++ and C#.) Applications developed with .NET under Windows have been primarily test and support applications for other development activities.