コード例 #1
0
ファイル: CircleSet.cs プロジェクト: sharespy/Astroder
        public void Add(PointF center, float radius, bool isFixed, Brush brush, Pen pen)
        {
            if (pen != null && !Toolkit.Contains(pen) && pen != DefaultPen)
            {
                Toolkit.Add(pen);
            }

            if (brush != null && !Toolkit.Contains(brush) && brush != DefaultBrush)
            {
                Toolkit.Add(brush);
            }

            Add(new CircleItem(Container, center, radius, isFixed, brush, pen));
        }
コード例 #2
0
        //public PointF ToControlPosition(float distanceLow, float angleLow, float ptShift)
        //{
        //    angleLow += AngleOffset;
        //    return Container.RelativeToCenter(distanceLow, angleLow, ptShift);
        //}

        public CircledPathes AddLines(float distance, float angleOffset, float length, float step, Pen pen, AngleFilterDelegate filter, bool isFixed)
        {
            if (!Toolkit.Contains(pen) && pen != null)
            {
                Toolkit.Add(pen);
            }

            int repetition = (int)(360 / step);
            //path.AddLine(-0.5f * length * Container.UnitSize, 0, 0.5f * length * Container.UnitSize, 0);
            GraphicsPath path = new GraphicsPath();

            path.AddLine(-0.5f * length, 0, 0.5f * length, 0);
            CircledPathes lines = new CircledPathes(Container, path, distance, angleOffset, 0, repetition, filter, isFixed, null, pen);

            Add(lines);
            return(lines);
        }
コード例 #3
0
        public PlanetSet(PolygonControl container) : base(container)
        {
            DirectFont = new Font("StarFont Sans", 16f, FontStyle.Bold);
            RetroFont  = new Font("StarFont Sans", 16f, FontStyle.Italic | FontStyle.Underline);
            //StarBrush = new SolidBrush(DefaultStarColor);
            //RetroBrush = new SolidBrush(DefaultRetroColor);
            StarPen = new Pen(DefaultStarColor);

            Toolkit.Add(DirectFont);
            Toolkit.Add(RetroFont);
            //Toolkit.Add(RetroBrush);
            //Toolkit.Add(StarBrush);
            Toolkit.Add(StarPen);

            Date      = new DateTimeOffset(DateTime.UtcNow.Date);
            IsVisible = true;

            container.CalculatorChanged += new PolygonControl.CalculatorChangedDelegate(container_CalculatorChanged);
        }
コード例 #4
0
        public List <AngledLabel> AddLables(List <String> lables, Font font, Brush fontBrush, float distance, float offset, float rotation, Brush brush, Pen pen)
        {
            if (font == null || fontBrush == null)
            {
                throw new ArgumentNullException();
            }

            if (!Toolkit.Contains(font))
            {
                Toolkit.Add(font);
            }

            if (!Toolkit.Contains(fontBrush))
            {
                Toolkit.Add(fontBrush);
            }

            if (pen != null && !Toolkit.Contains(pen))
            {
                Toolkit.Add(pen);
            }

            if (brush != null && !Toolkit.Contains(brush))
            {
                Toolkit.Add(brush);
            }

            int   repetition = lables.Count;
            float step       = (360 / repetition);
            float angle;
            List <AngledLabel> labels = new List <AngledLabel>();

            for (int i = 0; i < repetition; i++)
            {
                angle = i * step + offset;

                AngledLabel label = new AngledLabel(Container, lables[i], font, fontBrush, distance, angle, rotation, brush, pen);
                Add(label);
                labels.Add(label);
            }
            return(labels);
        }
コード例 #5
0
        public List <AngledLabel> AddLables(Font font, Brush fontBrush, float distance, float angleOffset, float rotation, int repetition, Brush brush, Pen pen)
        {
            if (font == null || fontBrush == null)
            {
                throw new ArgumentNullException();
            }

            if (!Toolkit.Contains(font))
            {
                Toolkit.Add(font);
            }

            if (!Toolkit.Contains(fontBrush))
            {
                Toolkit.Add(fontBrush);
            }

            if (!Toolkit.Contains(pen) && pen != null)
            {
                Toolkit.Add(pen);
            }

            if (!Toolkit.Contains(brush) && brush != null)
            {
                Toolkit.Add(brush);
            }

            float angle;
            float step = 360f / repetition;

            List <AngledLabel> labels = new List <AngledLabel>();

            for (int i = 0; i < repetition; i++)
            {
                angle = i * step + angleOffset;

                AngledLabel label = new AngledLabel(Container, angle.ToString(), font, fontBrush, distance, angle, rotation, brush, pen);
                Add(label);
                labels.Add(label);
            }
            return(labels);
        }
コード例 #6
0
        private void load()
        {
            DefaultSymbol = new GraphicsPath();
            DefaultSymbol.AddPolygon(DefaultShapePoints);

            TopBrush        = new SolidBrush(DefaultTopFillColor);
            BottomBrush     = new SolidBrush(DefaultBottomFillColor);
            HightlightBrush = new SolidBrush(Color.FromArgb(100, HighlightColor));

            TopBorderPen        = new Pen(Color.Red); //new Pen(DefaultTopBorderColor);
            BottomBorderPen     = new Pen(DefaultBottomBorderColor);
            HightlightBorderPen = new Pen(HighlightColor);

            TopLeadingPen                 = new Pen(DefaultTopLeadingColor, 1);
            TopLeadingPen.DashStyle       = DashStyle.Dash;
            BottomeLeadingPen             = new Pen(DefaultBottomLeadingColor, 1);
            BottomeLeadingPen.DashStyle   = DashStyle.Dash;
            HighlightLeadingPen           = new Pen(HighlightColor, 2);
            HighlightLeadingPen.DashStyle = DashStyle.DashDotDot;

            Toolkit.Add(TopBorderPen);
            Toolkit.Add(TopBrush);
            Toolkit.Add(TopLeadingPen);
            Toolkit.Add(BottomBorderPen);
            Toolkit.Add(BottomBrush);
            Toolkit.Add(BottomeLeadingPen);
            Toolkit.Add(HighlightLeadingPen);
            Toolkit.Add(HightlightBorderPen);
            Toolkit.Add(HightlightBrush);

            //DirectFont = new Font("AstroGadget", 18f, FontStyle.Bold);
            //StarBrush = new SolidBrush(DefaultStarColor);
            //RetroBrush = new SolidBrush(DefaultRetroColor);
            //StarPen = new Pen(DefaultStarColor);
            //Toolkit.Add(DirectFont);
            //Toolkit.Add(RetroBrush);
            //Toolkit.Add(StarBrush);
            //Toolkit.Add(StarPen);
        }
コード例 #7
0
        public CircledPathes AddPathSet(GraphicsPath path, float distance, float angleOffset, int repetition, bool isFixed, Brush brush, Pen pen)
        {
            if (path == null)
            {
                throw new ArgumentNullException();
            }

            if (!Toolkit.Contains(pen) && pen != null)
            {
                Toolkit.Add(pen);
            }

            if (!Toolkit.Contains(brush) && brush != null)
            {
                Toolkit.Add(brush);
            }

            CircledPathes pathSet = new CircledPathes(Container, path, distance, 0, 0, repetition, null, isFixed, brush, pen);

            Add(pathSet);

            return(pathSet);
        }
コード例 #8
0
        public AngledPath AddPath(GraphicsPath path, float distance, float angle, float rotation, bool isFixed, Brush brush, Pen pen)
        {
            if (path == null)
            {
                throw new ArgumentNullException();
            }

            if (!Toolkit.Contains(pen) && pen != null)
            {
                Toolkit.Add(pen);
            }

            if (!Toolkit.Contains(brush) && brush != null)
            {
                Toolkit.Add(brush);
            }

            AngledPath pathItem = new AngledPath(Container, path, distance, angle, rotation, isFixed, brush, pen);

            Add(pathItem);

            return(pathItem);
        }