本文整理匯總了C#中System.Windows.Media.Visual.IsAncestorOf方法的典型用法代碼示例。如果您正苦於以下問題:C# Visual.IsAncestorOf方法的具體用法?C# Visual.IsAncestorOf怎麽用?C# Visual.IsAncestorOf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Media.Visual
的用法示例。
在下文中一共展示了Visual.IsAncestorOf方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DumpParagraphOffset
// ------------------------------------------------------------------
// Dump paragraph offset.
// ------------------------------------------------------------------
private static Visual DumpParagraphOffset(XmlTextWriter writer, ParagraphResult paragraph, Visual visualParent)
{
Type paragraphResultType = paragraph.GetType();
System.Reflection.FieldInfo field = paragraphResultType.GetField("_paraClient", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
object paraClient = field.GetValue(paragraph);
Type paraClientType = paraClient.GetType();
System.Reflection.PropertyInfo prop = paraClientType.GetProperty("Visual", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
Visual visual = (Visual)prop.GetValue(paraClient, null);
// Dump transform relative to its parent
if(visualParent.IsAncestorOf(visual))
{
GeneralTransform g = visual.TransformToAncestor(visualParent);
Point point = new Point(0.0f, 0.0f);
g.TryTransform(point, out point);
if (point.X != 0 || point.Y != 0)
{
DumpPoint(writer, "Origin", point);
}
}
return visual;
}