本文整理匯總了C#中System.Windows.Media.Visual.SetFlagsOnAllChannels方法的典型用法代碼示例。如果您正苦於以下問題:C# Visual.SetFlagsOnAllChannels方法的具體用法?C# Visual.SetFlagsOnAllChannels怎麽用?C# Visual.SetFlagsOnAllChannels使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Media.Visual
的用法示例。
在下文中一共展示了Visual.SetFlagsOnAllChannels方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: PropagateFlags
/// <summary>
/// Propagates the flags up to the root.
/// </summary>
/// <remarks>
/// The walk stops on a node with all of the required flags set.
/// </remarks>
internal static void PropagateFlags(
Visual e,
VisualFlags flags,
VisualProxyFlags proxyFlags)
{
while ((e != null) &&
(!e.CheckFlagsAnd(flags) || !e.CheckFlagsOnAllChannels(proxyFlags)))
{
if (e.CheckFlagsOr(VisualFlags.ShouldPostRender))
{
MediaContext mctx = MediaContext.From(e.Dispatcher);
if (mctx.Channel != null)
{
mctx.PostRender();
}
}
else if (e.CheckFlagsAnd(VisualFlags.NodeIsCyclicBrushRoot))
{
//
// For visuals that are root nodes in visual brushes we
// need to fire OnChanged on the owning brushes.
//
Dictionary<ICyclicBrush, int> cyclicBrushToChannelsMap =
CyclicBrushToChannelsMapField.GetValue(e);
Debug.Assert(cyclicBrushToChannelsMap != null, "Visual brush roots need to have the visual brush to channels map!");
//
// Iterate over the visual brushes and fire the OnChanged event.
//
foreach (ICyclicBrush cyclicBrush in cyclicBrushToChannelsMap.Keys)
{
cyclicBrush.FireOnChanged();
}
}
e.SetFlags(true, flags);
e.SetFlagsOnAllChannels(true, proxyFlags);
if (e._parent == null)
{
// Stop propagating. We are at the root of the 2D subtree.
return;
}
Visual parentAsVisual = e._parent as Visual;
if (parentAsVisual == null)
{
// if the parent is not null (saw this with earlier null check) and is not a Visual
// it must be a Visual3D - continue the propagation
Visual3D.PropagateFlags((Visual3D)e._parent, flags, proxyFlags);
return;
}
e = parentAsVisual;
}
}