Exemplo n.º 1
0
        private void CursorData(float x, float y)
        {
            if (canvasparam.showcursordata == ShowCursorData.Hide)
            {
                return;
            }
            string value = "时间:";
            float  time  = 0F;

            if (dlList.Count > 0)
            {
                var c = listAxisParam.Find(t => t.Attributes == "Time");
                time = (x - canvasparam.OriginX) < 0 ? 0 : (x - canvasparam.OriginX) / (dlList[0].Hlength / (c.MaxScale - c.MinScale));
            }
            value += time.ToString("f2") + "\r\n";
            for (int i = 0; i < dlList.Count; i++)
            {
                value += dlList[i].Caption + ":" + dlList[i].GetLineData(x, y) + "\r\n";
            }
            var        brush  = new SharpDX.Direct2D1.SolidColorBrush(_renderTarget, new RawColor4(0, 0, 1, 1));
            RawVector2 pointS = new RawVector2(x, canvasparam.OriginY);
            RawVector2 pointE = new RawVector2(x, canvasparam.OriginY - canvasparam.VerticalLength);

            _renderTarget.DrawLine(pointS, pointE, brush);
            _renderTarget.DrawText(value, new TextFormat(dwfactory, "Arial", 12), new RawRectangleF(x, y, x + 100, y + 100), brush);
        }
Exemplo n.º 2
0
        private void button5_Click(object sender, EventArgs e)
        {
            var textformat = new DW.TextFormat(dwfactory, "宋体", 20);
            var brush      = new D2D.SolidColorBrush(_renderTarget, new SharpDX.Mathematics.Interop.RawColor4(1, 0, 0, 1));

            _renderTarget.BeginDraw();
            _renderTarget.Clear(new RawColor4(0.752F, 0.862F, 0752F, 0));
            textformat.FlowDirection    = DW.FlowDirection.TopToBottom;
            textformat.ReadingDirection = DW.ReadingDirection.RightToLeft;
            _renderTarget.DrawText("-20", textformat, new RawRectangleF(0, 0, 200, 200), brush);
            _renderTarget.EndDraw();
        }