53 lines
1.0 KiB
C#
53 lines
1.0 KiB
C#
![]() |
using System;
|
|||
|
using CPF.Drawing;
|
|||
|
using CPF.ReoGrid.Graphics;
|
|||
|
using CPF.ReoGrid.Rendering;
|
|||
|
|
|||
|
namespace CPF.ReoGrid.Drawing
|
|||
|
{
|
|||
|
public class ImageObject : DrawingObject
|
|||
|
{
|
|||
|
public Image Image { get; protected set; }
|
|||
|
|
|||
|
public ImageObject(Image image)
|
|||
|
{
|
|||
|
bool flag = image == null;
|
|||
|
if (flag)
|
|||
|
{
|
|||
|
throw new ArgumentNullException("image");
|
|||
|
}
|
|||
|
base.FillColor = Color.Transparent;
|
|||
|
base.LineColor = Color.Transparent;
|
|||
|
this.Image = image;
|
|||
|
float num = (float)image.Width;
|
|||
|
float num2 = (float)image.Height;
|
|||
|
base.Size = new Size(ref num, ref num2);
|
|||
|
}
|
|||
|
|
|||
|
protected override void OnPaint(RDrawingContext dc)
|
|||
|
{
|
|||
|
bool flag = this.Image == null;
|
|||
|
if (flag)
|
|||
|
{
|
|||
|
base.OnPaint(dc);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
IGraphics graphics = dc.Graphics;
|
|||
|
Rect clientBounds = this.ClientBounds;
|
|||
|
graphics.DrawImage(this.Image, clientBounds);
|
|||
|
bool flag2 = !base.LineColor.IsTransparent;
|
|||
|
if (flag2)
|
|||
|
{
|
|||
|
graphics.DrawRectangle(clientBounds, base.LineColor);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public string GetFriendlyTypeName()
|
|||
|
{
|
|||
|
return "Picture";
|
|||
|
}
|
|||
|
}
|
|||
|
}
|