示例#1
0
        public TextElement( String  str )
        {
            // set the text
            Internal_String = str;

            // init the lists
            listPlotsGeometry = new List<PlotGeometry>();

            // set the position and the size of the element
            this.Position = new Vector.FxVector2f( 0 );
            this.Size = new Vector.FxVector2f( 500, 250 );

            // init format
            _TextFormat = new TextElementFormat();
            _TextFormat.familyName = "Calibri";
            _TextFormat.weight = SharpDX.DirectWrite.FontWeight.Black;
            _TextFormat.fontStyle = SharpDX.DirectWrite.FontStyle.Normal;
            _TextFormat.fontStretch = SharpDX.DirectWrite.FontStretch.Normal;
            _TextFormat.fontSize = 8.0f;

            // init text rectangle
            textRectangle = new SharpDX.RectangleF( 0, 0, Size.x, Size.y );

            // init the color of the fonts
            _FontColor = new Color4(1.0f, 1.0f, 1.0f, 1.0f);
        }
示例#2
0
        private void InitPlotter(Vector.FxVectorF vec, PlotType plotType, Color color)
        {
            // init the lists
            listPlotsGeometry = new List<PlotGeometry>();

            // set the position and the size of the element
            this.Position = new Vector.FxVector2f(0);
            this.Size = new Vector.FxVector2f(750, 500);

            // add the vector to the list
            PlotGeometry plot = new PlotGeometry();
            plot.OrigVectorY = vec;
            plot.Color = color.ToColor4();
            plot.Type = plotType;
            plot.StepType = XStepType.ZeroToMax;

            // add the plot to the list
            listPlotsGeometry.Add(plot);

            // set the origin position
            {
                float max = vec.Max();
                float min = vec.Min();
                float orig_y = Size.Y / 2;
                if(max >0 && min<0)
                {
                    orig_y = Size.Y * (min / (max - min));
                }

                if(max >0 && min >= 0)
                {
                    orig_y = -min;
                }

                if(max <=0 && min <0)
                {
                    orig_y = Size.Y + max;
                }
                OriginPosition = new Vector.FxVector2f(5, orig_y);
            }

            // allocate scale
            _scale = new Vector.FxVector2f(1.0f);

            // fit the plots to the view
            FitPlots();

            // set the x_step base on the size of vec and the width
            X_Space = this.Size.x / vec.Size;

            // init format
            _TextFormat = new TextElementFormat();
            _TextFormat.familyName = "Calibri";
            _TextFormat.weight = SharpDX.DirectWrite.FontWeight.Black;
            _TextFormat.fontStyle = SharpDX.DirectWrite.FontStyle.Normal;
            _TextFormat.fontStretch = SharpDX.DirectWrite.FontStretch.Normal;
            _TextFormat.fontSize = 8.0f;

            // init toolstrip
            InitToolStrips();
        }