本文整理汇总了C#中Behaviac.Design.NodeViewData.GetTotalBoundingBox方法的典型用法代码示例。如果您正苦于以下问题:C# NodeViewData.GetTotalBoundingBox方法的具体用法?C# NodeViewData.GetTotalBoundingBox怎么用?C# NodeViewData.GetTotalBoundingBox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Behaviac.Design.NodeViewData
的用法示例。
在下文中一共展示了NodeViewData.GetTotalBoundingBox方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CenterNode
/// <summary>
/// Centres the given node in the view.
/// </summary>
/// <param name="node">The node which will be centred.</param>
internal void CenterNode(NodeViewData node) {
_maintainNodePosition = node;
// we use the existing maintain position stuff for that
RectangleF bbox = node.IsFSM ? node.GetTotalBoundingBox() : node.BoundingBox;
float width = bbox.Width <= 0.0f ? node.MinWidth : bbox.Width;
float height = bbox.Height <= 0.0f ? node.MinHeight : bbox.Height;
// Scale the whole graph to the suitable size in the view.
float viewWidth = ClientSize.Width - 30;
float viewHeight = ClientSize.Height - 30;
bool isWidthScale = false;
if (viewWidth > 0 && viewHeight > 0) {
SizeF totalSize = node.GetTotalSize(_nodeLayoutManager.Padding.Width, int.MaxValue);
float scale = 1.0f;
if (totalSize.Width / totalSize.Height < viewWidth / viewHeight) {
scale = viewHeight / totalSize.Height;
isWidthScale = false;
}
else {
scale = viewWidth / totalSize.Width;
isWidthScale = true;
}
const float MinScale = 0.1f;
const float MaxScale = 2.0f;
if (scale < MinScale) {
_nodeLayoutManager.Scale = MinScale;
}
else if (scale > MaxScale) {
_nodeLayoutManager.Scale = MaxScale;
}
else {
_nodeLayoutManager.Scale = scale;
}
}
if (node.IsFSM)
{
if (isWidthScale)
_graphOrigin = new PointF(0.0f, ClientSize.Height * 0.5f - height * 0.5f * _nodeLayoutManager.Scale);
else
_graphOrigin = new PointF(ClientSize.Width * 0.5f - width * 0.5f * _nodeLayoutManager.Scale, 0.0f);
}
else
{
_graphOrigin = new PointF(20.0f, ClientSize.Height * 0.5f - height * 0.5f);
}
Invalidate();
}