improved the forms designer
This commit is contained in:
Родитель
64f96d3b3e
Коммит
805e64d506
|
@ -6,6 +6,8 @@ using System.Windows.Forms;
|
|||
|
||||
namespace SkiaSharp.Views.Desktop
|
||||
{
|
||||
[DefaultEvent("PaintSurface")]
|
||||
[DefaultProperty("Name")]
|
||||
public class SKControl : Control
|
||||
{
|
||||
private readonly bool designMode;
|
||||
|
@ -20,8 +22,13 @@ namespace SkiaSharp.Views.Desktop
|
|||
designMode = DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime;
|
||||
}
|
||||
|
||||
[Bindable(false)]
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public SKSize CanvasSize => bitmap == null ? SKSize.Empty : new SKSize(bitmap.Width, bitmap.Height);
|
||||
|
||||
[Category("Appearance")]
|
||||
public event EventHandler<SKPaintSurfaceEventArgs> PaintSurface;
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
|
|
|
@ -5,6 +5,8 @@ using OpenTK;
|
|||
|
||||
namespace SkiaSharp.Views.Desktop
|
||||
{
|
||||
[DefaultEvent("PaintSurface")]
|
||||
[DefaultProperty("Name")]
|
||||
public class SKGLControl : GLControl
|
||||
{
|
||||
private readonly bool designMode;
|
||||
|
@ -19,10 +21,19 @@ namespace SkiaSharp.Views.Desktop
|
|||
ResizeRedraw = true;
|
||||
}
|
||||
|
||||
[Bindable(false)]
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public SKSize CanvasSize => new SKSize(renderTarget.Width, renderTarget.Height);
|
||||
|
||||
[Bindable(false)]
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public GRContext GRContext => grContext;
|
||||
|
||||
[Category("Appearance")]
|
||||
public event EventHandler<SKPaintGLSurfaceEventArgs> PaintSurface;
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
|
|
|
@ -11,6 +11,8 @@ using SkiaSharp.Views.Desktop;
|
|||
|
||||
namespace SkiaSharp.Views.WPF
|
||||
{
|
||||
[DefaultEvent("PaintSurface")]
|
||||
[DefaultProperty("Name")]
|
||||
public class SKElement : FrameworkElement
|
||||
{
|
||||
private readonly bool designMode;
|
||||
|
@ -23,6 +25,10 @@ namespace SkiaSharp.Views.WPF
|
|||
designMode = DesignerProperties.GetIsInDesignMode(this);
|
||||
}
|
||||
|
||||
[Bindable(false)]
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public SKSize CanvasSize => bitmap == null ? SKSize.Empty : new SKSize(bitmap.PixelWidth, bitmap.PixelHeight);
|
||||
|
||||
public bool IgnorePixelScaling
|
||||
|
@ -35,6 +41,7 @@ namespace SkiaSharp.Views.WPF
|
|||
}
|
||||
}
|
||||
|
||||
[Category("Appearance")]
|
||||
public event EventHandler<SKPaintSurfaceEventArgs> PaintSurface;
|
||||
|
||||
protected override void OnRender(DrawingContext drawingContext)
|
||||
|
|
Загрузка…
Ссылка в новой задаче