1

我将 geckofx v22.0.6 嵌入到 .Net 4 C# Winforms 测试应用程序中。使用 geckofx LoadHtml() 将 SVG 内容放入 gecko 的文档中。SVG 片段(为便于阅读而格式化):

<!-- 8 -->
<g id='node3' class='node'>
    <title>8</title>

    <polygon fill='red'
             stroke='red'
             points='571,-828 517,-828 517,-792 571,-792 571,-828'/>

    <text text-anchor='middle' x='544' y='-806.3'
          font-family='Times New Roman,serif' font-size='14.00'
          fill='white'>

        8(1)

    </text>
</g>

在我的表单上处理 DomMouseOver 事件:

void m_gb_DomMouseOver(object sender, Gecko.DomMouseEventArgs e)
{
    var tgt = e.Target.CastToGeckoElement();

    if (tgt.NodeName.ToLower() == "text")
    {
        var parent = tgt.ParentNode;

        foreach (var child in parent.ChildNodes)
        {
            if (child.NodeName.ToLower() != "polygon")
                continue;

            var poly = child as GeckoElement;
        }
    }
}

poly 变量始终为空。在调试器的监视窗口中,我尝试将 child 转换为各种事物(SvgElement、GeckoElement 等),它只是想保留 GeckoNode。为什么是这样?

4

1 回答 1

0

这是 GeckoFx 的 QueryInterface 中的一个错误。https://bitbucket.org/geckofx/geckofx-22.0/issue/54/casting-geckonode-to-geckoelement-for-svg

在 v22.0.6 的提示中修复

于 2013-11-14T01:16:20.833 回答