本文整理汇总了C#中System.Windows.Media.HitTestResult类的典型用法代码示例。如果您正苦于以下问题:C# HitTestResult类的具体用法?C# HitTestResult怎么用?C# HitTestResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HitTestResult类属于System.Windows.Media命名空间,在下文中一共展示了HitTestResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HitTestCallback
private HitTestResultBehavior HitTestCallback(HitTestResult result)
{
var rayhit = result as RayHitTestResult;
hitTestValue = rayhit.PointHit;
hit = true;
return HitTestResultBehavior.Continue;
}
示例2: HitTest
HitTestResultBehavior HitTest(HitTestResult ht)
{
var r = ht as RayMeshGeometry3DHitTestResult;
if (r == null) return HitTestResultBehavior.Continue;
svr.Move(bFirst, r.PointHit.X < (svr.BarPos(bFirst) - 0.5 + barRate / 2) * 300);
return HitTestResultBehavior.Stop;
}
示例3: ResultCallBack
public HitTestResultBehavior ResultCallBack(HitTestResult result)
{
// Did we hit 3D?
RayHitTestResult rayResult = result as RayHitTestResult;
if (rayResult != null)
{
// Did we hit a MeshGeometry3D?
RayMeshGeometry3DHitTestResult rayMeshResult =
rayResult as RayMeshGeometry3DHitTestResult;
if (rayMeshResult != null)
{
GeometryModel3D hitgeo = rayMeshResult.ModelHit as GeometryModel3D;
DiffuseMaterial dm = hitgeo.Material as DiffuseMaterial;
SolidColorBrush b = dm.Brush as SolidColorBrush;
Color c = b.Color;
c.ScB = 1 - c.ScB;
c.ScG = 1 - c.ScG;
c.ScR = 1 - c.ScR;
hitgeo.Material = new DiffuseMaterial(new SolidColorBrush(c));
}
}
return HitTestResultBehavior.Continue;
}
示例4: SelectModel
private HitTestResultBehavior SelectModel(HitTestResult result)
{
RayHitTestResult res = result as RayHitTestResult;
if (res != null)
{
DependencyObject visual = res.VisualHit;
object model = null, scene = null;
while (visual != null)
{
if (consoleMode)
{
if (visual is Model)
scope.SetVariable("model", model = visual);
else if (visual is Scene)
scope.SetVariable("scene", scene = visual);
}
else
Control.SendClick(visual, result);
visual = VisualTreeHelper.GetParent(visual);
}
selection.Text = $"Selection: {model} in {scene}";
}
return HitTestResultBehavior.Stop;
}
示例5: MainHitTestResult
public HitTestResultBehavior MainHitTestResult(HitTestResult result)
{
if ((result.VisualHit as DrawingVisual) != null)
{
hittedElements.Add(result.VisualHit as DrawingVisual);
}
return HitTestResultBehavior.Continue;
}
示例6: InfoHitTestSelOneResultCallback
HitTestResultBehavior InfoHitTestSelOneResultCallback(HitTestResult result) {
var frameworkElement = result.VisualHit as FrameworkElement;
if (frameworkElement == null)
return HitTestResultBehavior.Continue;
_infoShape = frameworkElement;
return HitTestResultBehavior.Stop;
}
示例7: RailHitTestSelOneResultCallback
HitTestResultBehavior RailHitTestSelOneResultCallback(HitTestResult result) {
var frameworkElement = result.VisualHit as FrameworkElement;
if (frameworkElement == null || !(frameworkElement.Tag is Rail))
return HitTestResultBehavior.Continue;
_railUnderMouse = frameworkElement.Tag as Rail;
return HitTestResultBehavior.Stop;
}
示例8: MyCallback
// If a child visual object is hit, toggle its opacity to visually indicate a hit.
public HitTestResultBehavior MyCallback(HitTestResult result)
{
if (result.VisualHit.GetType() == typeof (System.Windows.Media.DrawingVisual))
{
((System.Windows.Media.DrawingVisual) result.VisualHit).Opacity =
((System.Windows.Media.DrawingVisual) result.VisualHit).Opacity == 1.0 ? 0.4 : 1.0;
}
// Stop the hit test enumeration of objects in the visual tree.
return HitTestResultBehavior.Stop;
}
示例9: PerformHitTest
// Return the result of the hit test to the callback.
public HitTestResultBehavior PerformHitTest(HitTestResult result)
{
FrameworkElement visual = (FrameworkElement)result.VisualHit;
// Add the hit test result to the list that will be processed after the enumeration.
if (visual.IsHitTestVisible)
hitTestResults.Add(visual);
else
return HitTestResultBehavior.Stop;
// Set the behavior to return visuals at all z-order levels.
return HitTestResultBehavior.Continue;
}
示例10: HitTestCallback
private HitTestResultBehavior HitTestCallback(HitTestResult result)
{
GeometryHitTestResult geometryResult = (GeometryHitTestResult)result;
DrawingVisual visual = result.VisualHit as DrawingVisual;
if (visual != null &&
geometryResult.IntersectionDetail == IntersectionDetail.FullyInside)
{
hits.Add(visual);
}
return HitTestResultBehavior.Continue;
}
示例11: OnVisualHit
protected HitTestResultBehavior OnVisualHit(HitTestResult result)
{
foreach (NameValuePair nvp in dataPoints)
{
if (nvp.Tag == result.VisualHit)
{
MessageBox.Show("Name: " + nvp.Name + ", Value: " + nvp.Value.ToString());
break;
}
}
return HitTestResultBehavior.Continue;
}
示例12: CircleHitTestResult
// Handle the hit test results enumeration in the callback.
internal static HitTestResultBehavior CircleHitTestResult(HitTestResult result)
{
// Add the hit test result to the list that will be processed after the enumeration.
HitResultsList.Add(result.VisualHit);
// Determine whether hit test should return only the top-most layer visual.
if (MyWindow.TopmostLayer)
{
// Set the behavior to stop the enumeration of visuals.
return HitTestResultBehavior.Stop;
}
// Set the behavior to continue the enumeration of visuals.
// All visuals that intersect at the hit test coordinates are returned,
// whether visible or not.
return HitTestResultBehavior.Continue;
}
示例13: MyHitTestResult
// Return the result of the hit test to the callback.
public HitTestResultBehavior MyHitTestResult(HitTestResult result)
{
if (result.VisualHit is FrameworkElement)
{
if (((FrameworkElement) result.VisualHit).DataContext is Appraisal)
{
hitResultsList.Add(((FrameworkElement)result.VisualHit).DataContext as Appraisal);
}
}
// Add the hit test result to the list that will be processed after the enumeration.
// Set the behavior to return visuals at all z-order levels.
return HitTestResultBehavior.Stop;
}
示例14: myCallback
// If a child visual object is hit, toggle its opacity to visually indicate a hit.
public HitTestResultBehavior myCallback(HitTestResult result)
{
if (result.VisualHit.GetType() == typeof(DrawingVisual))
{
if (((DrawingVisual)result.VisualHit).Opacity == 1.0)
{
((DrawingVisual)result.VisualHit).Opacity = 0.4;
}
else
{
((DrawingVisual)result.VisualHit).Opacity = 1.0;
}
}
// Stop the hit test enumeration of objects in the visual tree.
return HitTestResultBehavior.Stop;
}
示例15: myCallback
public HitTestResultBehavior myCallback(HitTestResult result)
{
// Toggle between a skewed rendering and normal rendering,
// if a visual was clicked.
if (result.VisualHit.GetType() == typeof(DrawingVisual))
{
if (((DrawingVisual)result.VisualHit).Transform == null)
{
((DrawingVisual)result.VisualHit).Transform = new SkewTransform(7, 7);
}
else
{
((DrawingVisual)result.VisualHit).Transform = null;
}
}
// Tell HitTest() to stop drilling into the visual tree.
return HitTestResultBehavior.Stop;
}