本文整理汇总了C#中System.Windows.Media.GeneralTransform.TransformBounds方法的典型用法代码示例。如果您正苦于以下问题:C# GeneralTransform.TransformBounds方法的具体用法?C# GeneralTransform.TransformBounds怎么用?C# GeneralTransform.TransformBounds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.GeneralTransform
的用法示例。
在下文中一共展示了GeneralTransform.TransformBounds方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBounds
private Rect GetBounds(StylusPoint stylusPoint,
Point position,
IInputElement relativeTo,
GeneralTransform elementToRoot,
GeneralTransform rootToElement)
{
// Get width and heith in pixel value
double width = GetStylusPointWidthOrHeight(stylusPoint, /*isWidth*/ true);
double height = GetStylusPointWidthOrHeight(stylusPoint, /*isWidth*/ false);
// Get the position with respect to root
Point rootPoint;
if (elementToRoot == null ||
!elementToRoot.TryTransform(position, out rootPoint))
{
rootPoint = position;
}
// Create a Rect with respect to root and transform it to element coordinate space
Rect rectBounds = new Rect(rootPoint.X - width * 0.5, rootPoint.Y - height * 0.5, width, height);
if (rootToElement != null)
{
rectBounds = rootToElement.TransformBounds(rectBounds);
}
return rectBounds;
}
示例2: FixedSOMImage
//--------------------------------------------------------------------
//
// Constructors
//
//---------------------------------------------------------------------
#region Constructors
private FixedSOMImage(Rect imageRect, GeneralTransform trans, Uri sourceUri, FixedNode node, DependencyObject o) : base(node, trans)
{
_boundingRect = trans.TransformBounds(imageRect);
_source = sourceUri;
_startIndex = 0;
_endIndex = 1;
_name = AutomationProperties.GetName(o);
_helpText = AutomationProperties.GetHelpText(o);
}
示例3: FixedSOMTextRun
//--------------------------------------------------------------------
//
// Constructors
//
//---------------------------------------------------------------------
#region Constructors
private FixedSOMTextRun(Rect boundingRect, GeneralTransform trans, FixedNode fixedNode, int startIndex, int endIndex) : base(fixedNode, startIndex, endIndex, trans)
{
_boundingRect = trans.TransformBounds(boundingRect);
}
示例4: MouseMoved
/// <summary>
/// Handles when the mouse moves
/// </summary>
/// <param name="mousePos"></param>
/// <param name="screenToSceneTransform"></param>
public void MouseMoved(Point mousePos, GeneralTransform screenToSceneTransform)
{
if (screenToSceneTransform == null)
return;
// Convert the mouse coordinates to scene coordinates
mousePos = screenToSceneTransform.Transform(mousePos);
bool newLocked = false;
Point newPoint = mousePos;
if (points.Count > 0)
{
// Transform the minimum distance ignoring the translation
Rect minimumBounds = screenToSceneTransform.TransformBounds(minimumDistance);
double nearestDistanceSquared;
newPoint = GetEllipseScaledNearestPoint(points, mousePos, (Vector) (minimumBounds.Size),
out nearestDistanceSquared);
newLocked = nearestDistanceSquared <= 1;
}
bool lockedChanged = newLocked != locked;
bool pointChanged = newPoint != closestPoint;
locked = newLocked;
closestPoint = newPoint;
if ((pointChanged && locked) || lockedChanged)
{
OnClosestPointChanged();
}
}
示例5: MouseMoved
/// <summary>
/// Handles when the mouse moves
/// </summary>
/// <param name="mousePos"></param>
/// <param name="screenToSceneTransform"></param>
public Point MouseMoved(Point mousePos, GeneralTransform screenToSceneTransform) {
if(screenToSceneTransform == null)
return new Point(0, 0);
// Convert the mouse coordinates to scene coordinates
mousePos = screenToSceneTransform.Transform(mousePos);
// Transform the minimum distance ignoring the translation
Rect minimumBounds = screenToSceneTransform.TransformBounds(_minimumDistance);
return MouseMoved(mousePos, minimumBounds);
}
示例6: QueueMouseMove
public void QueueMouseMove(Point mousePos, GeneralTransform screenToSceneTransform) {
mousePos = screenToSceneTransform.Transform(mousePos);
Rect minimumBounds = screenToSceneTransform.TransformBounds(_minimumDistance);
_mousePosQueue.Add(new PointAndBounds(mousePos, minimumBounds));
}
示例7: SetStringFormat
/// <summary>
/// Works out the number of decimal places required to show the different between
/// 2 pixels. E.g if pixels are .1 apart then use 2 places etc
/// </summary>
private void SetStringFormat(GeneralTransform transform)
{
var rect = new Rect(0, 0, 1, 1);
rect = transform.TransformBounds(rect);
var xFigures = (int) (Math.Ceiling(-Math.Log10(rect.Width)) + .1);
var yFigures = (int) (Math.Ceiling(-Math.Log10(rect.Height)) + .1);
xFormat = "#0.";
yFormat = "#0.";
for (int i = 0; i < xFigures; ++i)
{
xFormat += "#";
}
for (int i = 0; i < yFigures; ++i)
{
yFormat += "#";
}
}