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


C# ICanvas.ToUnit方法代码示例

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


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

示例1: SnapPointBase

 public SnapPointBase(ICanvas canvas, IDrawObject owner, UnitPoint snappoint)
 {
     m_owner = owner;
     m_snappoint = snappoint;
     float size = (float)canvas.ToUnit(14);
     m_boundingRect.X = (float)(snappoint.X - size / 2);
     m_boundingRect.Y = (float)(snappoint.Y - size / 2);
     m_boundingRect.Width = size;
     m_boundingRect.Height = size;
 }
开发者ID:sduxiaowu,项目名称:NineLineScore,代码行数:10,代码来源:SnapPoints.cs

示例2: ThresholdWidth

 public static float ThresholdWidth(ICanvas canvas, float objectwidth, float pixelwidth)
 {
     double minWidth = canvas.ToUnit(pixelwidth);
     double width = Math.Max(objectwidth / 2, minWidth);
     return (float)width;
 }
开发者ID:sduxiaowu,项目名称:NineLineScore,代码行数:6,代码来源:LineTool.cs

示例3: ToUnitNormalized

 public static RectangleF ToUnitNormalized(ICanvas canvas, Rectangle screenrect)
 {
     UnitPoint point = canvas.ToUnit(screenrect.Location);
     SizeF size = new SizeF((float)canvas.ToUnit(screenrect.Width), (float)canvas.ToUnit(screenrect.Height));
     RectangleF unitrect = new RectangleF(point.Point, size);
     unitrect.Y = unitrect.Y - unitrect.Height; //
     return unitrect;
 }
开发者ID:jjacksons,项目名称:GLUE,代码行数:8,代码来源:Utils.cs

示例4: SnapPoint

 public ISnapPoint SnapPoint(ICanvas canvas, UnitPoint point, List<IDrawObject> otherobj)
 {
     if (Enabled == false)
         return null;
     UnitPoint snappoint = new UnitPoint();
     UnitPoint mousepoint = point;
     float gridX = Spacing.Width;
     float gridY = Spacing.Height;
     snappoint.X = (float)(Math.Round(mousepoint.X / gridX)) * gridX;
     snappoint.Y = (float)(Math.Round(mousepoint.Y / gridY)) * gridY;
     double threshold = canvas.ToUnit(/*ThresholdPixel*/6);
     if ((snappoint.X < point.X - threshold) || (snappoint.X > point.X + threshold))
         return null;
     if ((snappoint.Y < point.Y - threshold) || (snappoint.Y > point.Y + threshold))
         return null;
     return new GridSnapPoint(canvas, snappoint);
 }
开发者ID:jjacksons,项目名称:GLUE,代码行数:17,代码来源:GridLayer.cs

示例5: StartAngleNodePoint

 UnitPoint StartAngleNodePoint(ICanvas canvas)
 {
     double r = Radius + canvas.ToUnit(8);
     return HitUtil.PointOncircle(m_center, r, HitUtil.DegressToRadians(StartAngle));
 }
开发者ID:jjacksons,项目名称:GLUE,代码行数:5,代码来源:ArcCircle3PointTool.cs

示例6: RadiusNodePoint

 UnitPoint RadiusNodePoint(ICanvas canvas)
 {
     double r = Radius + canvas.ToUnit(8);
     float angle = StartAngle + SweepAngle / 2;
     return HitUtil.PointOncircle(m_center, r, HitUtil.DegressToRadians(angle));
 }
开发者ID:jjacksons,项目名称:GLUE,代码行数:6,代码来源:ArcCircle3PointTool.cs

示例7: GetBoundingRect

        public RectangleF GetBoundingRect(ICanvas canvas)
        {
            float thWidth = Line.ThresholdWidth(canvas, Width, ThresholdPixel);
            if (thWidth < Width)
                thWidth = Width;

            RectangleF rect = RectangleF.Empty;

            // if one of the points is empty, then a straight line is drawn, so return bounding rect for a line
            if (m_p2.IsEmpty || m_p3.IsEmpty)
                rect = ScreenUtils.GetRect(m_p1, m_lastPoint, thWidth);

            if (rect.IsEmpty)
            {
                float r = m_radius + thWidth / 2;
                rect = HitUtil.CircleBoundingRect(m_center, r);
                if (Selected)
                {
                    float w = (float)canvas.ToUnit(20); // include space for the 'extern' nodes
                    rect.Inflate(w, w);
                }
            }
            // if drawing either angle then include the mouse point in the rectangle - this is to redraw (erase) the line drawn
            // from center point to mouse point
            //if (m_curPoint == eCurrentPoint.startAngle || m_curPoint == eCurrentPoint.endAngle)
            if (m_lastPoint.IsEmpty == false)
                rect = RectangleF.Union(rect, new RectangleF(m_lastPoint.Point, new SizeF(0,0)));
            return rect;
        }
开发者ID:jjacksons,项目名称:GLUE,代码行数:29,代码来源:ArcCircle3PointTool.cs


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