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


C# Test2d.Record类代码示例

本文整理汇总了C#中Test2d.Record的典型用法代码示例。如果您正苦于以下问题:C# Record类的具体用法?C# Record怎么用?C# Record使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Record类属于Test2d命名空间,在下文中一共展示了Record类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Bind

 /// <summary>
 /// 
 /// </summary>
 /// <param name="r"></param>
 public override void Bind(Record r)
 {
     base.Bind(r ?? this.Record);
 }
开发者ID:monocraft,项目名称:Test2d,代码行数:8,代码来源:XRectangle.cs

示例2: Draw

        /// <summary>
        /// 
        /// </summary>
        /// <param name="gfx"></param>
        /// <param name="qbezier"></param>
        /// <param name="dx"></param>
        /// <param name="dy"></param>
        /// <param name="db"></param>
        /// <param name="r"></param>
        public void Draw(object gfx, XQBezier qbezier, double dx, double dy, ImmutableArray<ShapeProperty> db, Record r)
        {
            var _gfx = gfx as Graphics;

            Brush brush = ToSolidBrush(qbezier.Style.Fill);
            Pen pen = ToPen(qbezier.Style, _scaleToPage);

            double x1 = qbezier.Point1.X;
            double y1 = qbezier.Point1.Y;
            double x2 = qbezier.Point1.X + (2.0 * (qbezier.Point2.X - qbezier.Point1.X)) / 3.0;
            double y2 = qbezier.Point1.Y + (2.0 * (qbezier.Point2.Y - qbezier.Point1.Y)) / 3.0;
            double x3 = x2 + (qbezier.Point3.X - qbezier.Point1.X) / 3.0;
            double y3 = y2 + (qbezier.Point3.Y - qbezier.Point1.Y) / 3.0;
            double x4 = qbezier.Point3.X;
            double y4 = qbezier.Point3.Y;

            if (qbezier.IsFilled)
            {
                var path = new GraphicsPath();
                path.AddBezier(
                    _scaleToPage(x1 + dx),
                    _scaleToPage(y1 + dy),
                    _scaleToPage(x2 + dx),
                    _scaleToPage(y2 + dy),
                    _scaleToPage(x3 + dx),
                    _scaleToPage(y3 + dy),
                    _scaleToPage(x4 + dx),
                    _scaleToPage(y4 + dy));
                _gfx.FillPath(brush, path);
            }

            if (qbezier.IsStroked)
            {
                _gfx.DrawBezier(
                    pen,
                    _scaleToPage(x1 + dx),
                    _scaleToPage(y1 + dy),
                    _scaleToPage(x2 + dx),
                    _scaleToPage(y2 + dy),
                    _scaleToPage(x3 + dx),
                    _scaleToPage(y3 + dy),
                    _scaleToPage(x4 + dx),
                    _scaleToPage(y4 + dy));
            }

            brush.Dispose();
            pen.Dispose();
        }
开发者ID:monocraft,项目名称:Test2d,代码行数:57,代码来源:EmfRenderer.cs

示例3: Draw

        /// <summary>
        /// 
        /// </summary>
        /// <param name="gfx"></param>
        /// <param name="text"></param>
        /// <param name="dx"></param>
        /// <param name="dy"></param>
        /// <param name="db"></param>
        /// <param name="r"></param>
        public void Draw(object gfx, XText text, double dx, double dy, ImmutableArray<ShapeProperty> db, Record r)
        {
            var _gfx = gfx as Graphics;

            var tbind = text.BindToTextProperty(db, r);
            if (string.IsNullOrEmpty(tbind))
                return;

            var brush = ToSolidBrush(text.Style.Stroke);

            var fontStyle = Eto.Drawing.FontStyle.None;
            if (text.Style.TextStyle.FontStyle.Flags.HasFlag(Test2d.FontStyleFlags.Bold))
            {
                fontStyle |= Eto.Drawing.FontStyle.Bold;
            }

            if (text.Style.TextStyle.FontStyle.Flags.HasFlag(Test2d.FontStyleFlags.Italic))
            {
                fontStyle |= Eto.Drawing.FontStyle.Italic;
            }

            var fontDecoration = Eto.Drawing.FontDecoration.None;
            if (text.Style.TextStyle.FontStyle.Flags.HasFlag(Test2d.FontStyleFlags.Underline))
            {
                fontDecoration |= Eto.Drawing.FontDecoration.Underline;
            }

            if (text.Style.TextStyle.FontStyle.Flags.HasFlag(Test2d.FontStyleFlags.Strikeout))
            {
                fontDecoration |= Eto.Drawing.FontDecoration.Strikethrough;
            }

            var font = new Font(
                text.Style.TextStyle.FontName,
                (float)(text.Style.TextStyle.FontSize * _textScaleFactor),
                fontStyle,
                fontDecoration);

            var rect = CreateRect(
                text.TopLeft,
                text.BottomRight,
                dx, dy);

            var srect = new RectangleF(
                _scaleToPage(rect.X),
                _scaleToPage(rect.Y),
                _scaleToPage(rect.Width),
                _scaleToPage(rect.Height));

            var size = _gfx.MeasureString(font, tbind);
            var origin = GetTextOrigin(text.Style, ref srect, ref size);

            _gfx.DrawText(
                font,
                brush,
                origin,
                tbind);

            brush.Dispose();
            font.Dispose();
        }
开发者ID:gitter-badger,项目名称:Test2d,代码行数:70,代码来源:EtoRenderer.cs

示例4: TryToBind

        /// <summary>
        /// 
        /// </summary>
        /// <param name="bindings"></param>
        /// <param name="r"></param>
        /// <param name="propertyNameX"></param>
        /// <param name="propertyNameY"></param>
        private void TryToBind(
            ImmutableArray<ShapeBinding> bindings,
            Record r,
            string propertyNameX,
            string propertyNameY)
        {
            if (r == null || bindings == null || bindings.Length <= 0)
                return;

            if (r.Columns == null || r.Values == null || r.Columns.Length != r.Values.Length)
                return;

            foreach (var binding in bindings)
            {
                if (string.IsNullOrEmpty(binding.Property) || string.IsNullOrEmpty(binding.Path))
                    continue;

                if (binding.Property == propertyNameX)
                {
                    BindToDouble(binding, r, ref _x);
                }
                else if (binding.Property == propertyNameY)
                {
                    BindToDouble(binding, r, ref _y);
                }
            }
        }
开发者ID:gitter-badger,项目名称:Test2d,代码行数:34,代码来源:XPoint.cs

示例5: Bind

 /// <summary>
 /// 
 /// </summary>
 /// <param name="r"></param>
 public override void Bind(Record r)
 {
     var record = r ?? this.Data.Record;
     var bindings = this.Data.Bindings;
     string propertyNameX = "X";
     string propertyNameY = "Y";
     TryToBind(bindings, record, propertyNameX, propertyNameY);
 }
开发者ID:gitter-badger,项目名称:Test2d,代码行数:12,代码来源:XPoint.cs

示例6: BindToDouble

        /// <summary>
        /// 
        /// </summary>
        /// <param name="binding"></param>
        /// <param name="r"></param>
        /// <param name="value"></param>
        private static void BindToDouble(ShapeBinding binding, Record r, ref double value)
        {
            var columns = r.Columns;
            for (int i = 0; i < columns.Length; i++)
            {
                if (columns[i].Name != binding.Path)
                    continue;

                double result;
                bool success = double.TryParse(
                    r.Values[i].Content,
                    NumberStyles.Any, CultureInfo.InvariantCulture,
                    out result);
                if (success)
                {
                    value = result;
                    break;
                }
            }
        }
开发者ID:gitter-badger,项目名称:Test2d,代码行数:26,代码来源:XPoint.cs

示例7: Draw

        /// <summary>
        /// 
        /// </summary>
        /// <param name="dc"></param>
        /// <param name="renderer"></param>
        /// <param name="dx"></param>
        /// <param name="dy"></param>
        /// <param name="db"></param>
        /// <param name="r"></param>
        public override void Draw(object dc, IRenderer renderer, double dx, double dy, ImmutableArray<ShapeProperty> db, Record r)
        {
            var record = r ?? this.Data.Record;

            if (_shape != null)
            {
                if (State.Flags.HasFlag(ShapeStateFlags.Visible))
                {
                    _shape.Draw(dc, renderer, X + dx, Y + dy, db, record);
                }
            }
        }
开发者ID:gitter-badger,项目名称:Test2d,代码行数:21,代码来源:XPoint.cs

示例8: Bind

 /// <summary>
 /// 
 /// </summary>
 /// <param name="r"></param>
 public override void Bind(Record r)
 {
     var record = r ?? this.Record;
     _point1.TryToBind("Point1", this.Bindings, record);
     _point2.TryToBind("Point2", this.Bindings, record);
     _point3.TryToBind("Point3", this.Bindings, record);
     _point4.TryToBind("Point4", this.Bindings, record);
 }
开发者ID:monocraft,项目名称:Test2d,代码行数:12,代码来源:XArc.cs

示例9: Draw

        /// <summary>
        /// 
        /// </summary>
        /// <param name="dc"></param>
        /// <param name="renderer"></param>
        /// <param name="dx"></param>
        /// <param name="dy"></param>
        /// <param name="db"></param>
        /// <param name="r"></param>
        public override void Draw(object dc, IRenderer renderer, double dx, double dy, ImmutableArray<ShapeProperty> db, Record r)
        {
            var record = r ?? this.Record;

            if (State.HasFlag(ShapeState.Visible))
            {
                renderer.Draw(dc, this, dx, dy, db, record);
                base.Draw(dc, renderer, dx, dy, db, record);
            }
        }
开发者ID:monocraft,项目名称:Test2d,代码行数:19,代码来源:XRectangle.cs

示例10: DropAsShapeAndBind

        /// <summary>
        /// 
        /// </summary>
        /// <param name="record"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        public void DropAsShapeAndBind(Record record, double x, double y)
        {
            switch (_editor.CurrentTool)
            {
                case Tool.Point:
                    {
                        var point = XPoint.Create(x, y, _editor.Project.Options.PointShape);
                        point.Record = record;

                        if (record.Columns.Length >= 2)
                        {
                            point.Bindings = point.Bindings.Add(ShapeBinding.Create("X", record.Columns[0].Name));
                            point.Bindings = point.Bindings.Add(ShapeBinding.Create("Y", record.Columns[1].Name));
                        }

                        _editor.AddWithHistory(point);
                    }
                    break;
                case Tool.Line:
                    {
                        var line = XLine.Create(
                            x, y,
                            _editor.Project.CurrentStyleLibrary.CurrentStyle,
                            _editor.Project.Options.PointShape);
                        line.Record = record;

                        if (record.Columns.Length >= 2)
                        {
                            line.Bindings = line.Bindings.Add(ShapeBinding.Create("Start.X", record.Columns[0].Name));
                            line.Bindings = line.Bindings.Add(ShapeBinding.Create("Start.Y", record.Columns[1].Name));
                        }

                        if (record.Columns.Length >= 4)
                        {
                            line.Bindings = line.Bindings.Add(ShapeBinding.Create("End.X", record.Columns[2].Name));
                            line.Bindings = line.Bindings.Add(ShapeBinding.Create("End.Y", record.Columns[3].Name));
                        }

                        _editor.AddWithHistory(line);
                    }
                    break;
                case Tool.Rectangle:
                    {
                        var rectangle = XRectangle.Create(
                            x, y,
                            _editor.Project.CurrentStyleLibrary.CurrentStyle,
                            _editor.Project.Options.PointShape);
                        rectangle.Record = record;

                        if (record.Columns.Length >= 2)
                        {
                            rectangle.Bindings = rectangle.Bindings.Add(ShapeBinding.Create("TopLeft.X", record.Columns[0].Name));
                            rectangle.Bindings = rectangle.Bindings.Add(ShapeBinding.Create("TopLeft.Y", record.Columns[1].Name));
                        }

                        if (record.Columns.Length >= 4)
                        {
                            rectangle.Bindings = rectangle.Bindings.Add(ShapeBinding.Create("BottomRight.X", record.Columns[2].Name));
                            rectangle.Bindings = rectangle.Bindings.Add(ShapeBinding.Create("BottomRight.Y", record.Columns[3].Name));
                        }

                        _editor.AddWithHistory(rectangle);
                    }
                    break;
                case Tool.Ellipse:
                    {
                        var ellipse = XEllipse.Create(
                            x, y,
                            _editor.Project.CurrentStyleLibrary.CurrentStyle,
                            _editor.Project.Options.PointShape);
                        ellipse.Record = record;

                        if (record.Columns.Length >= 2)
                        {
                            ellipse.Bindings = ellipse.Bindings.Add(ShapeBinding.Create("TopLeft.X", record.Columns[0].Name));
                            ellipse.Bindings = ellipse.Bindings.Add(ShapeBinding.Create("TopLeft.Y", record.Columns[1].Name));
                        }

                        if (record.Columns.Length >= 4)
                        {
                            ellipse.Bindings = ellipse.Bindings.Add(ShapeBinding.Create("BottomRight.X", record.Columns[2].Name));
                            ellipse.Bindings = ellipse.Bindings.Add(ShapeBinding.Create("BottomRight.Y", record.Columns[3].Name));
                        }

                        _editor.AddWithHistory(ellipse);
                    }
                    break;
                case Tool.Arc:
                    {
                        var arc = XArc.Create(
                            x, y,
                            _editor.Project.CurrentStyleLibrary.CurrentStyle,
                            _editor.Project.Options.PointShape);
                        arc.Record = record;
//.........这里部分代码省略.........
开发者ID:monocraft,项目名称:Test2d,代码行数:101,代码来源:EditorContext.cs

示例11: Bind

 /// <summary>
 /// 
 /// </summary>
 /// <param name="r"></param>
 public override void Bind(Record r)
 {
     var record = r ?? this.Record;
     _start.TryToBind("Start", this.Bindings, record);
     _end.TryToBind("End", this.Bindings, record);
 }
开发者ID:monocraft,项目名称:Test2d,代码行数:10,代码来源:XLine.cs

示例12: DropAsGroup

        /// <summary>
        ///
        /// </summary>
        /// <param name="record"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        public void DropAsGroup(Record record, double x, double y)
        {
            var g = XGroup.Create("g");
            g.Record = record;

            double sx = _editor.Project.Options.SnapToGrid ? Editor.Snap(x, _editor.Project.Options.SnapX) : x;
            double sy = _editor.Project.Options.SnapToGrid ? Editor.Snap(y, _editor.Project.Options.SnapY) : y;

            var length = record.Values.Length;
            double px = sx;
            double py = sy;
            double width = 150;
            double height = 15;

            for (int i = 0; i < length; i++)
            {
                var column = record.Columns[i];
                if (column.IsVisible)
                {
                    var text = XText.Create(
                        px, py,
                        px + width, py + height,
                        _editor.Project.CurrentStyleLibrary.CurrentStyle,
                        _editor.Project.Options.PointShape, "");
                    var binding = ShapeBinding.Create("Text", record.Columns[i].Name);
                    text.Bindings = text.Bindings.Add(binding);
                    g.AddShape(text);

                    py += height;
                }
            }

            var rectangle = XRectangle.Create(
                sx, sy,
                sx + width, sy + (double)length * height,
                _editor.Project.CurrentStyleLibrary.CurrentStyle,
                _editor.Project.Options.PointShape);
            g.AddShape(rectangle);

            double ptx = sx + width / 2;
            double pty = sy;

            double pbx = sx + width / 2;
            double pby = sy + (double)length * height;

            double plx = sx;
            double ply = sy + ((double)length * height) / 2;

            double prx = sx + width;
            double pry = sy + ((double)length * height) / 2;

            var pt = XPoint.Create(ptx, pty, _editor.Project.Options.PointShape);
            var pb = XPoint.Create(pbx, pby, _editor.Project.Options.PointShape);
            var pl = XPoint.Create(plx, ply, _editor.Project.Options.PointShape);
            var pr = XPoint.Create(prx, pry, _editor.Project.Options.PointShape);

            g.AddConnectorAsNone(pt);
            g.AddConnectorAsNone(pb);
            g.AddConnectorAsNone(pl);
            g.AddConnectorAsNone(pr);

            _editor.AddWithHistory(g);
        }
开发者ID:monocraft,项目名称:Test2d,代码行数:69,代码来源:EditorContext.cs

示例13: Draw

        /// <summary>
        /// 
        /// </summary>
        /// <param name="dc"></param>
        /// <param name="renderer"></param>
        /// <param name="dx"></param>
        /// <param name="dy"></param>
        /// <param name="db"></param>
        /// <param name="r"></param>
        public override void Draw(object dc, IRenderer renderer, double dx, double dy, ImmutableArray<ShapeProperty> db, Record r)
        {
            var record = r ?? this.Record;

            if (State.HasFlag(ShapeState.Visible))
            {
                renderer.Draw(dc, this, dx, dy, db, record);
            }

            if (renderer.State.SelectedShape != null)
            {
                if (this == renderer.State.SelectedShape)
                {
                    _start.Draw(dc, renderer, dx, dy, db, record);
                    _end.Draw(dc, renderer, dx, dy, db, record);
                }
                else if (_start == renderer.State.SelectedShape)
                {
                    _start.Draw(dc, renderer, dx, dy, db, record);
                }
                else if (_end == renderer.State.SelectedShape)
                {
                    _end.Draw(dc, renderer, dx, dy, db, record);
                }
            }

            if (renderer.State.SelectedShapes != null)
            {
                if (renderer.State.SelectedShapes.Contains(this))
                {
                    _start.Draw(dc, renderer, dx, dy, db, record);
                    _end.Draw(dc, renderer, dx, dy, db, record);
                }
            }
        }
开发者ID:monocraft,项目名称:Test2d,代码行数:44,代码来源:XLine.cs

示例14: Bind

        /// <summary>
        /// 
        /// </summary>
        /// <param name="r"></param>
        public override void Bind(Record r)
        {
            var record = r ?? this.Data.Record;

            foreach (var shape in Shapes)
            {
                shape.Bind(record);
            }

            foreach (var connector in Connectors)
            {
                connector.Bind(record);
            }
        }
开发者ID:gitter-badger,项目名称:Test2d,代码行数:18,代码来源:XGroup.cs

示例15: Draw

        /// <summary>
        /// 
        /// </summary>
        /// <param name="dc"></param>
        /// <param name="renderer"></param>
        /// <param name="dx"></param>
        /// <param name="dy"></param>
        /// <param name="db"></param>
        /// <param name="r"></param>
        public override void Draw(object dc, IRenderer renderer, double dx, double dy, ImmutableArray<ShapeProperty> db, Record r)
        {
            var record = r ?? this.Data.Record;

            if (State.Flags.HasFlag(ShapeStateFlags.Visible))
            {
                foreach (var shape in Shapes)
                {
                    shape.Draw(dc, renderer, dx, dy, db, record);
                }
            }

            if (renderer.State.SelectedShape != null)
            {
                if (this == renderer.State.SelectedShape)
                {
                    foreach (var connector in Connectors)
                    {
                        connector.Draw(dc, renderer, dx, dy, db, record);
                    }
                }
                else
                {
                    foreach (var connector in Connectors)
                    {
                        if (connector == renderer.State.SelectedShape)
                        {
                            connector.Draw(dc, renderer, dx, dy, db, record);
                        }
                    }
                }
            }

            if (renderer.State.SelectedShapes != null)
            {
                if (renderer.State.SelectedShapes.Contains(this))
                {
                    foreach (var connector in Connectors)
                    {
                        connector.Draw(dc, renderer, dx, dy, db, record);
                    }
                }
            }
        }
开发者ID:gitter-badger,项目名称:Test2d,代码行数:53,代码来源:XGroup.cs


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