Beispiel #1
0
        Node DrawCustomShape(float x, float y)
        {
            var node = new Node();

            if (Device.RuntimePlatform == Device.Android)
            {
                node.Width = 50 * DiagramUtility.factor; node.Height = 40 * DiagramUtility.factor;
            }
            else
            {
                node.Width = node.Height = 40 * DiagramUtility.factor;
            }
            node.OffsetX = x * DiagramUtility.factor; node.OffsetY = y * DiagramUtility.factor;
            if (Device.RuntimePlatform == Device.UWP)
            {
                node.Style.Brush       = new SolidBrush(Color.Transparent);
                node.Style.StrokeBrush = new SolidBrush(Color.FromRgb(24, 161, 237));
                node.Style.StrokeWidth = 3 * DiagramUtility.factor;
            }
            SfGraphicsPath sfpath4 = new SfGraphicsPath();
            SfGraphics     grap    = new SfGraphics();
            Pen            stroke  = new Pen();

            stroke.Brush       = new SolidBrush(Color.Transparent);
            stroke.StrokeWidth = 3;
            stroke.StrokeBrush = new SolidBrush(Color.FromRgb(24, 161, 237));
            grap.DrawEllipse(stroke, new Rectangle(10, 0, 20, 20));
            if (Device.RuntimePlatform == Device.UWP)
            {
                grap.DrawArc(stroke, 0, 20, 40, 40, 0, 180);
            }
            else
            {
                grap.DrawArc(stroke, 0, 20, 40, 40, 180, 180);
            }
            node.UpdateSfGraphics(grap);
            return(node);
        }
Beispiel #2
0
        private void ButtonTouch(object sender, EventArgs e)
        {
            ImageButtonView view = sender as ImageButtonView;

            view.ButtonSelected = true;
            switch (view.ImageId)
            {
            case "mindmapconttree.png":
                simpleCurveTree = "contCurveTree";
                SfGraphicsPath path = new SfGraphicsPath();
                path.MoveTo(0, 0);
                path.MoveTo(0, 50);
                path.LineTo(100, 50);
                path.MoveTo(100, 100);
                gra.DrawPath(path);
                Pen pe = new Pen();
                pe.StrokeBrush = new SolidBrush(Color.ParseColor("#949494"));
                pe.StrokeWidth = 5;
                point.Add(new Point(0, 50));
                point.Add(new Point(100, 50));
                gra.DrawLines(pe, point);
                objShape1 = ShapeType.Ellipse;
                objShape2 = gra;
                objShape3 = gra;
                objShape4 = gra;
                objShape5 = gra;
                segment   = SegmentType.CurveSegment;
                TextStyleVerticalAlignment = VerticalAlignment.Top;
                Dectype   = DecoratorType.None;
                connColor = Color.Black;
                connLineApplyColorFrom = ApplyColorFrom.TargetBorder;
                connDecApplyColorFrom  = ApplyColorFrom.TargetBorder;
                break;

            case "mindmapDefault.png":
                simpleCurveTree            = "default";
                objShape1                  = ShapeType.RoundedRectangle;
                objShape2                  = ShapeType.RoundedRectangle;
                objShape3                  = ShapeType.RoundedRectangle;
                objShape4                  = ShapeType.RoundedRectangle;
                objShape5                  = ShapeType.RoundedRectangle;
                segment                    = SegmentType.CurveSegment;
                TextStyleVerticalAlignment = VerticalAlignment.Center;
                Dectype                    = DecoratorType.None;
                connColor                  = Color.Black;
                connLineApplyColorFrom     = ApplyColorFrom.TargetBorder;
                connDecApplyColorFrom      = ApplyColorFrom.TargetBorder;
                break;

            case "mindmaportho.png":
                simpleCurveTree            = "orthotree";
                objShape1                  = ShapeType.Rectangle;
                objShape2                  = ShapeType.Rectangle;
                objShape3                  = ShapeType.Rectangle;
                objShape4                  = ShapeType.Rectangle;
                objShape5                  = ShapeType.Rectangle;
                segment                    = SegmentType.OrthoSegment;
                TextStyleVerticalAlignment = VerticalAlignment.Center;
                Dectype                    = DecoratorType.None;
                connColor                  = Color.Black;
                connLineApplyColorFrom     = ApplyColorFrom.TargetBorder;
                connDecApplyColorFrom      = ApplyColorFrom.TargetBorder;
                break;

            case "mindmapsimpletree.png":
                simpleCurveTree            = "simpleCurveTree";
                objShape1                  = ShapeType.RoundedRectangle;
                objShape2                  = ShapeType.RoundedRectangle;
                objShape3                  = ShapeType.RoundedRectangle;
                objShape4                  = ShapeType.RoundedRectangle;
                objShape5                  = ShapeType.RoundedRectangle;
                segment                    = SegmentType.CurveSegment;
                TextStyleVerticalAlignment = VerticalAlignment.Center;
                Dectype                    = DecoratorType.None;
                connColor                  = Color.ParseColor("#949494");
                connLineApplyColorFrom     = ApplyColorFrom.Custom;
                connDecApplyColorFrom      = ApplyColorFrom.Custom;
                break;
            }
            UpdateTheme();

            for (int i = 0; i < scrollLayout.ChildCount; i++)
            {
                ImageButtonView childView = (ImageButtonView)scrollLayout.GetChildAt(i);
                if (childView.ImageId == view.ImageId)
                {
                    continue;
                }
                childView.ButtonSelected = false;
            }
        }