|
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing ;
using System.Runtime.Serialization;
using System.Windows.Forms;
namespace BizDraw.Objects
{
[System.Runtime.InteropServices.ComVisible(true)]
[Serializable()]
/// <summary>
/// Rectangle graphic object
/// </summary>
public class DrawImage : BizDraw.Objects.DrawRectangle , ISerializable
{
private Image picture;
private string picturePath;
public string PicturePath
{
get
{
return picturePath;
}
set
{
picturePath = value;
Picture = new Bitmap(value);
}
}
public Image Picture
{
get
{
return picture ;
}
set
{
picture = value;
}
}
public DrawImage() : base()
{
}
public DrawImage(int x, int y, int width, int height) : base(x,y, width, height )
{
}
public override BizDraw.Objects.Editors.IDrawObjectEditor GetEditor()
{
return new Editors.FrmImageEditor();
}
/// <summary>
/// Draw rectangle
/// </summary>
/// <param name="g"></param>
public override void Draw(Graphics g)
{
base.Draw(g);
if (picture !=null )
g.DrawImage(picture, this.Rectangle );
}
#region ISerializable Members
public new void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
info.AddValue("Picture", this.Picture);
info.AddValue("PicturePath", this.PicturePath );
}
public DrawImage(SerializationInfo info, StreamingContext context)
: base(info, context )
{
this.Picture = (Image)info.GetValue("Picture", typeof(Image ));
this.picturePath = info.GetString("PicturePath");
}
#endregion
}
}
|
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.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here