0

我正在使用 Visual Studio 2017 构建 Windows UWP 应用程序。

我的 XML 代码是:

<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
            xmlns:forms="clr-namespace:SkiaSharp.Views.Forms;assembly=SkiaSharp.Views.Forms"
            x:Class="Test_SMLibrary.Lines_and_Text">

  <ContentPage>
    <forms:SKCanvasView x:Name="CanvasView"
                        PaintSurface="CanvasView_PaintSurface" 
                        IgnorePixelScaling="True"
                        HorizontalOptions="Fill"
                        VerticalOptions="Fill"/>
  </ContentPage>

</TabbedPage>

我的 C# 代码是:

namespace Test_SMLibrary {
  [XamlCompilation(XamlCompilationOptions.Compile)]
  public partial class Lines_and_Text {
    public Lines_and_Text() {
      InitializeComponent();
    }

    private void CanvasView_PaintSurface(object sender, SKPaintSurfaceEventArgs e) {
      var surface = e.Surface;
      var canvas = surface.Canvas;
      var width = e.Info.Width;
      var height = e.Info.Height;
      canvas.Clear(SKColors.LightGray);

      Debug.WriteLine("width: " + width + ", height: " + height);
    }
  }
}

只有在水平方向调整窗口大小时才会发生调试写入。当窗口在垂直方向调整大小时不执行。为什么?

查尔斯

4

1 回答 1

0

这是我的版本:

在此处输入图像描述

另外,这是我的环境:

Microsoft Visual Studio Professional 2017 
Version 15.5.7
VisualStudio.15.Release/15.5.7+27130.2036
Microsoft .NET Framework
Version 4.7.02556

Installed Version: Professional

Visual Basic 2017   00369-60000-00001-AA307
Microsoft Visual Basic 2017

Visual C# 2017   00369-60000-00001-AA307
Microsoft Visual C# 2017

Visual F# 4.1   00369-60000-00001-AA307
Microsoft Visual F# 4.1

Application Insights Tools for Visual Studio Package   8.10.01106.1
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017   15.0.31129.0
ASP.NET and Web Tools 2017

ASP.NET Core Razor Language Services   1.0
Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2017   5.2.51007.0
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   15.0.31106.0
Azure App Service Tools v3.0.0

Clear Recent   1.0.0
Clears recent projects and files lists

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Cookiecutter   3.0.17320.1
Provides tools for finding, instantiating and customizing templates in cookiecutter format.

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

JavaScript UWP Project System   2.0
JavaScript UWP Project System

JetBrains ReSharper Ultimate 2017.3.2    Build 111.0.20180201.63358
JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2018 JetBrains, Inc.

Merq   1.1.17-rc (cba4571)
Command Bus, Event Stream and Async Manager for Visual Studio extensions.

Microsoft Continuous Delivery Tools for Visual Studio   0.3
Simplifying the configuration of continuous build integration and continuous build delivery from within the Visual Studio IDE.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual Studio Tools for Containers   1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio   4.8.4-pre (3fe64e3)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   4.5.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

Python   3.0.17320.1
Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.

Python - IronPython support   3.0.17320.1
Provides templates and integration for IronPython-based projects.

Python - Profiling support   3.0.17320.1
Profiling support for Python projects.

R Tools for Visual Studio   1.3.31108.1213
Provides project system, R Interactive window, plotting, and more for the R programming language.

RelayCommand Extension   1.0
RelayCommand Visual Studio Extension Detailed Info

SQL Server Data Tools   15.1.61710.120
Microsoft SQL Server Data Tools

TypeScript Tools   15.5.11025.1
TypeScript Tools for Microsoft Visual Studio

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for AI   0.3.3.0
An integrated development environment for AI / Deep Learning application development.

Visual Studio Tools for AI: Azure Batch AI   0.3.3.0
This package provides Azure Batch AI support in Visual Studio Tools for AI.

Visual Studio Tools for AI: Azure Machine Learning   0.3.3.0
This package provides Azure Machine Learning support in Visual Studio Tools for AI.

Visual Studio Tools for AI: Remote Machine   0.3.3.0
This package provides Remote Machine support in Visual Studio Tools for AI.

Visual Studio Tools for Universal Windows Apps   15.0.27130.2036
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

Xamarin   4.8.0.760 (fc93f3f5b)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   4.8.188 (c5813fa34)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin.Android SDK   8.1.5.0 (HEAD/75f8c6838)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK   11.6.1.4 (db807ec)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

查尔斯

于 2018-03-06T15:59:22.910 回答