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


C# IPath.GetBounds方法代码示例

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


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

示例1: AddPath

        public void AddPath(IPath path, bool connect)
        {
            if (connect)
            {
                throw new Exception("The method or operation is not implemented.");
            }
            else
            {
                if (path is VectorPath)
                {
                    m_editMask.FillPath(Brushes.Black, (VectorPath)path);
                    m_editVisual.FillPath(m_visualFill, (VectorPath)path);

                    m_lineTrace.StartFigure();
                    m_lineTrace.AddPath((VectorPath)path, false);

                    // keep track of bounds
                    RectangleF rect = path.GetBounds();
                    if (rect.Left < m_left)
                        m_left = (int)rect.Left;
                    if (rect.Right > m_left + m_width)
                        m_width = (int)rect.Right - m_left;
                    if (rect.Top < m_top)
                        m_top = (int)rect.Top;
                    if (rect.Bottom > m_top + m_height)
                        m_height = (int)rect.Bottom - m_top;

                    m_count += path.PointCount;
                }
                else if (path is BitmapPath)
                {
                    if (m_count == 0)
                    {
                        BitmapPath o = (BitmapPath)path;
                        m_editMask.DrawImage(o.m_mask, new Point(0, 0));
                        m_editVisual.DrawImage(o.m_visual, new Point(0, 0));
                        m_count = o.m_count;
                        m_left = o.m_left;
                        m_top = o.m_top;
                        m_width = o.m_width;
                        m_height = o.m_height;

                        if (o.m_lineTrace.PointCount > 0)
                        {
                            m_lineTrace.StartFigure();
                            m_lineTrace.AddPath(o.m_lineTrace, false);
                        }
                        // m_lineTrace.AddRectangle(new Rectangle(m_left, m_top, m_width, m_height));

                    }
                    else
                    {
                        throw new Exception("not implemented");
                    }
                }
            }
        }
开发者ID:rhfung,项目名称:KinematicTemplates,代码行数:57,代码来源:BitmapPath.cs


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