我注意到,当覆盖System.Windows.Window OnRender方法无法绘制到屏幕时.我确定这是一个很好的理由,但无法找到解释.
以下代码演示了这一点:
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace WpfApplication1
{
public partial class Window1 : Window
{
Pen pen = new Pen();
public Window1()
{
InitializeComponent();
pen.Brush = Brushes.Black;
}
protected override void OnRender(DrawingContext dc)
{
base.OnRender(dc);
dc.DrawRectangle(Brushes.Black, pen, new Rect(0, 0, 600, 400));
dc.DrawEllipse(Brushes.Green, pen, new Point(300, 300), 50, 50);
}
}
}
Run Code Online (Sandbox Code Playgroud)
替换FrameworkElement中的绘图逻辑(然后将元素设置为窗口的内容)工作正常.
谢谢,
丹尼
现在FSharp v1已进入Beta版,现在可以询问vNext了.
该FSharp语言规范定义了以下保留关键字:
atomic break checked component const constraint constructor
continue eager fixed fori functor include
method mixin object parallel params process protected pure
sealed tailcall trait virtual volatile
Run Code Online (Sandbox Code Playgroud)
你希望看到哪些实现,为什么?
请回答一个关键字.
用什么语言编写Swift 2.0编译器?C++?
自托管的swift会更强大吗?更理想吗?
Swift的编译器API如何与F#或https://github.com/dotnet/roslyn进行比较?