/// <summary>
        /// Cursor that is round or square, radius defined by the nibSize and elements within Workshop
        /// </summary>
        public static Cursor NibCursor(float nibSize, bool isRound, float scaling = 1)
        {
            float Diameter = 1;

            Diameter = nibSize * scaling;

            int      Size      = Convert.ToInt32(Math.Ceiling(Diameter + 2));
            Bitmap   CursorBmp = new Bitmap(Size, Size);
            Graphics g         = Graphics.FromImage(CursorBmp);

            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            g.Clear(Color.Transparent);
            Pen CursorPen = null;

            if (isRound)
            {
                CursorPen = new Pen(Color.AntiqueWhite, 1.8f);
                g.DrawEllipse(CursorPen, 1, 1, Diameter, Diameter);
            }
            else
            {
                CursorPen = new Pen(Color.AntiqueWhite, 1f);
                g.DrawRectangle(CursorPen, 1, 1, Diameter, Diameter);
            }

            CursorPen.Dispose();
            g.Dispose();

            Diameter /= 2;
            Size      = Convert.ToInt32(Math.Ceiling(Diameter)) + 1;
            return(CreateCursor(CursorBmp, Size, Size));
        }
Beispiel #2
0
        public void Bind(FormulaChart fc)
        {
            foreach (FormulaArea fa in fc.Areas)
            {
                if (fa.AxisXs.Count != AxisXs.Count)
                {
                    fa.AxisXs.Clear();
                    for (int i = 0; i < AxisXs.Count; i++)
                    {
                        fa.AxisXs.Add(new FormulaAxisX()); //AxisXs[i]
                    }
                    if (AxisXs.Count > 0)
                    {
                        fa.AxisX = fa.AxisXs[0];
                    }
                }

                for (int i = 0; i < AxisXs.Count; i++)
                {
                    fa.AxisXs[i].CopyFrom(AxisXs[i]);
                }

                foreach (FormulaAxisY fay in fa.AxisYs)
                {
                    fay.CopyFrom(AxisY);
                }
                fa.Back    = (FormulaBack)Back.Clone();
                fa.Colors  = (Color[])Colors.Clone();
                fa.LinePen = LinePen.GetPen();                                                                    // LinePen.Clone();

                fa.BarPens         = new Pen[] { BarPens[0].GetPen(), BarPens[1].GetPen(), BarPens[2].GetPen() }; // (Pen[])BarPens.Clone();
                fa.BarBrushes      = new Brush[] { BarBrushes[0].GetBrush(), BarBrushes[1].GetBrush(), BarBrushes[2].GetBrush() };
                fa.NameBrush       = NameBrush.GetBrush();
                fa.NameFont        = (Font)NameFont.Clone();
                fa.TextFont        = (Font)TextFont.Clone();
                fa.StockRenderType = StockRenderType;
                if (fa.IsMain())
                {
                    fa.AxisY.Scale = scaleType;
                }
            }
            fc.StickRenderType     = StickRenderType;
            fc.CursorPen           = CursorPen.GetPen();
            fc.ShowXAxisInLastArea = ShowXAxisInLastArea;
            fc.ShowValueLabel      = ShowValueLabel;
            fc.AllXFormats         = AllXFormats;
        }