当前位置: 首页>>代码示例>>C#>>正文


C# NodeViewData.CanBeExpanded方法代码示例

本文整理汇总了C#中Behaviac.Design.NodeViewData.CanBeExpanded方法的典型用法代码示例。如果您正苦于以下问题:C# NodeViewData.CanBeExpanded方法的具体用法?C# NodeViewData.CanBeExpanded怎么用?C# NodeViewData.CanBeExpanded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Behaviac.Design.NodeViewData的用法示例。


在下文中一共展示了NodeViewData.CanBeExpanded方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Draw


//.........这里部分代码省略.........
                RectangleF rect = boundingBox;
                rect.Inflate(-_highlightedStyle.Border.Width, -_highlightedStyle.Border.Width);

                DrawShapeBorder(graphics, rect, style.Border);

            } else {
                DrawShapeBorder(graphics, boundingBox, style.Border);
            }
            }

            // draw the profile info
            if (profileInfos != null && profileInfos.Count > 0) {
            string fullId = nvd.FullId;

            if (profileInfos.ContainsKey(fullId)) {
                FrameStatePool.NodeProfileInfos.ProfileInfo profileInfo = profileInfos[fullId];
                string timeStr = string.Format("{0:F3}", Math.Abs(profileInfo.Time));
                string avgTimeStr = (profileInfo.Count <= 0) ? "0" : string.Format("{0:F3}", profileInfo.TotalTime / profileInfo.Count);
                string info = string.Format("{0}  {1}  {2}", timeStr, avgTimeStr, profileInfo.Count);
                SizeF txtSize = MeasureDisplayStringWidth(graphics, info, _profileFont);
                float x = boundingBox.Left;
                float y = boundingBox.Top - txtSize.Height - 2;
                graphics.DrawString(info, (profileInfo.Time >= 0) ? _profileBoldFont : _profileFont, Brushes.Black, x, y);
            }
            }

            // draw the attached condition
            foreach(Node.Connector connector in nvd.Connectors) {
            if (!connector.IsAsChild) {
                PointF[] vertices = getConnectorTriangle(nvd, connector);

                Brush brush = isCurrent && nvd.IsInExpandConnectorRange(graphMousePos) ? Brushes.Yellow : Brushes.Blue;

                graphics.FillPolygon(Brushes.LightGray, vertices);

                if (this.IsExpanded && connector.ChildCount > 0) {
                    graphics.FillRectangle(brush, vertices[0].X + 0.5f, vertices[0].Y + 3.5f, 5.5f, 1.5f);

                    if (!connector.IsExpanded)
                    { graphics.FillRectangle(brush, vertices[0].X + 2.5f, vertices[0].Y + 1.5f, 1.5f, 5.5f); }
                }
            }
            }

            // draw the breakpoints
            bool isBreakpointHighlighted = false;
            const float width = 18.0f;
            BreakPointStates enterState = getBreakPointState(highlightBreakPoint, HighlightBreakPoint.kEnter);

            if (HighlightBreakPoint.ShowBreakPoint && (enterState == BreakPointStates.Normal || enterState == BreakPointStates.Disable) ||
            enterState == BreakPointStates.Highlight) {
            isBreakpointHighlighted |= (enterState == BreakPointStates.Highlight);

            float x = boundingBox.X + width * 0.1f;
            float y = boundingBox.Y + (boundingBox.Height - width) * 0.5f;

            graphics.FillEllipse(getBrush(enterState), x, y, width, width);
            }

            BreakPointStates exitState = getBreakPointState(highlightBreakPoint, HighlightBreakPoint.kExit);

            if (HighlightBreakPoint.ShowBreakPoint && (exitState == BreakPointStates.Normal || exitState == BreakPointStates.Disable) ||
            exitState == BreakPointStates.Highlight) {
            isBreakpointHighlighted |= (exitState == BreakPointStates.Highlight);

            float x = boundingBox.X + (boundingBox.Width - width) - width * 0.1f;
            float y = boundingBox.Y + (boundingBox.Height - width) * 0.5f;

            graphics.FillEllipse(getBrush(exitState), x, y, width, width);
            }

            BreakPointStates planState = getBreakPointState(highlightBreakPoint, HighlightBreakPoint.kPlanning);

            if (HighlightBreakPoint.ShowBreakPoint && (planState == BreakPointStates.Normal || planState == BreakPointStates.Disable) ||
            planState == BreakPointStates.Highlight) {
            isBreakpointHighlighted |= (planState == BreakPointStates.Highlight);

            float x = boundingBox.X + (boundingBox.Width * 0.5f) - width * 0.5f;
            float y = boundingBox.Y + (boundingBox.Height - width) * 0.5f;

            graphics.FillEllipse(getBrush(planState), x, y, width, width);
            }

            // draw the expand or collapse symbol
            if (nvd.CanBeExpanded()) {
            Brush brush = isCurrent && nvd.IsInExpandRange(graphMousePos) ? Brushes.Yellow : Brushes.LightGray;

            graphics.FillRectangle(brush, boundingBox.X + 5.0f, boundingBox.Y + 5.0f, 12.0f, 2.0f);

            if (!nvd.IsExpanded)
            { graphics.FillRectangle(brush, boundingBox.X + 10.0f, boundingBox.Y, 2.0f, 12.0f); }
            }

            // draw node id
            if (ShowNodeId) {
            graphics.DrawString(nvd.FullId, _profileFont, isBreakpointHighlighted ? Brushes.Yellow : Brushes.White, boundingBox.X, boundingBox.Y + boundingBox.Height);
            }

            //graphics.DrawRectangle(Pens.Red, nvd.LayoutRectangle.X, nvd.LayoutRectangle.Y, nvd.LayoutRectangle.Width, nvd.LayoutRectangle.Height);
        }
开发者ID:XyzalZhang,项目名称:behaviac,代码行数:101,代码来源:NodeViewData.cs


注:本文中的Behaviac.Design.NodeViewData.CanBeExpanded方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。