Files
PCK-Studio/PCK-Studio/ToolboxItems/InterpolationPictureBox.cs
2024-01-22 18:36:57 +01:00

30 lines
1.0 KiB
C#

using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace PckStudio.ToolboxItems
{
/// <summary>
/// Inherits from PictureBox; adds Interpolation Mode Setting
/// </summary>
public class InterpolationPictureBox : PictureBox
{
public InterpolationMode InterpolationMode { get; set; }
public InterpolationMode BackgroundInterpolationMode { get; set; }
protected override void OnPaintBackground(PaintEventArgs paintEventArgs)
{
paintEventArgs.Graphics.InterpolationMode = BackgroundInterpolationMode;
paintEventArgs.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
base.OnPaintBackground(paintEventArgs);
}
protected override void OnPaint(PaintEventArgs paintEventArgs)
{
paintEventArgs.Graphics.InterpolationMode = InterpolationMode;
paintEventArgs.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
base.OnPaint(paintEventArgs);
}
}
}