Added SkiaSharp.Views.Forms.WinForms.Forms, SkiaSharp Sample code

This commit is contained in:
aosoft 2018-01-04 19:48:31 +09:00
Родитель 5a9a4c4a5f
Коммит 015fa3932e
7 изменённых файлов: 30 добавлений и 7 удалений

Просмотреть файл

@ -0,0 +1,10 @@
namespace SkiaSharp.Views.Forms.WinForms
{
public class Forms
{
public static void Init()
{
// for AssemblyLoad
}
}
}

Просмотреть файл

@ -10,10 +10,11 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SkiaSharp.Views.Forms.WinForms</RootNamespace>
<AssemblyName>SkiaSharp.Views.Forms.WinForms</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -66,6 +67,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Forms.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ISKCanvasViewController.cs" />
<Compile Include="RendererTypes.cs" />

Просмотреть файл

@ -2,6 +2,6 @@
<packages>
<package id="SkiaSharp" version="1.59.3" targetFramework="net461" />
<package id="SkiaSharp.Views" version="1.59.3" targetFramework="net461" />
<package id="SkiaSharp.Views.Forms" version="1.59.3" targetFramework="net461" />
<package id="SkiaSharp.Views.Forms" version="1.59.3" targetFramework="net461" requireReinstallation="true" />
<package id="Xamarin.Forms" version="2.5.0.91635" targetFramework="net461" />
</packages>

Просмотреть файл

@ -19,13 +19,11 @@
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Label
<skia:SKCanvasView
Grid.Column="0" Grid.Row="0"
Grid.ColumnSpan="2"
Grid.RowSpan="2"
HorizontalTextAlignment="Start"
VerticalTextAlignment="Start"
Text="LeftTop"/>
PaintSurface="SKCanvasView_PaintSurface"/>
<Label
Grid.Column="2" Grid.Row="0"
HorizontalTextAlignment="End"

Просмотреть файл

@ -1,4 +1,5 @@
using System;
using SkiaSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -20,5 +21,12 @@ namespace Xamarin.Forms.ControlGallery.WinForms
{
System.Windows.Forms.MessageBox.Show("Clicked!");
}
private void SKCanvasView_PaintSurface(object sender, SkiaSharp.Views.Forms.SKPaintSurfaceEventArgs e)
{
var p = new SKPaint();
p.Color = SKColors.Aqua;
e.Surface.Canvas.DrawCircle(100, 100, 20, p);
}
}
}

Просмотреть файл

@ -19,6 +19,7 @@ namespace Xamarin.Forms.ControlGallery.WinForms
var f = new Platform.WinForms.PlatformRenderer();
Xamarin.Forms.Platform.WinForms.Forms.Init(f);
SkiaSharp.Views.Forms.WinForms.Forms.Init();
f.Width = 800;
f.Height = 600;

Просмотреть файл

@ -99,6 +99,10 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SkiaSharp.Views.Forms.WinForms\SkiaSharp.Views.Forms.WinForms.csproj">
<Project>{dc2d61aa-3749-485b-a6bb-343e738211a8}</Project>
<Name>SkiaSharp.Views.Forms.WinForms</Name>
</ProjectReference>
<ProjectReference Include="..\Xamarin.Forms.Platform.WinForms\Xamarin.Forms.Platform.WinForms.csproj">
<Project>{cd51aedc-e33d-4620-a9c6-9683891ef615}</Project>
<Name>Xamarin.Forms.Platform.WinForms</Name>