Beispiel #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            var strokeStylePropertiesFlat = new D2D.StrokeStyleProperties();

            strokeStylePropertiesFlat.StartCap = D2D.CapStyle.Flat;
            strokeStylePropertiesFlat.EndCap   = D2D.CapStyle.Flat;
            var strokeStylePropertiesRound = new D2D.StrokeStyleProperties();

            strokeStylePropertiesRound.StartCap = D2D.CapStyle.Round;
            strokeStylePropertiesRound.EndCap   = D2D.CapStyle.Round;
            var strokeStylePropertiesSquare = new D2D.StrokeStyleProperties();

            strokeStylePropertiesSquare.StartCap = D2D.CapStyle.Square;
            strokeStylePropertiesSquare.EndCap   = D2D.CapStyle.Round;
            var strokeStylePropertiesTriangle = new D2D.StrokeStyleProperties();

            strokeStylePropertiesTriangle.StartCap = D2D.CapStyle.Triangle;
            strokeStylePropertiesTriangle.EndCap   = D2D.CapStyle.Round;
            var strokeStyleFlat     = new StrokeStyle(factory, strokeStylePropertiesFlat);
            var strokeStyleRound    = new StrokeStyle(factory, strokeStylePropertiesRound);
            var strokeStyleSquare   = new StrokeStyle(factory, strokeStylePropertiesSquare);
            var strokeStyleTriangle = new StrokeStyle(factory, strokeStylePropertiesTriangle);
            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));
            _renderTarget.DrawLine(new RawVector2(100, 50), new RawVector2(200, 50), brush, 10, strokeStyleFlat);
            _renderTarget.DrawLine(new RawVector2(100, 100), new RawVector2(200, 100), brush, 10, strokeStyleRound);
            _renderTarget.DrawLine(new RawVector2(100, 150), new RawVector2(200, 150), brush, 10, strokeStyleSquare);
            _renderTarget.DrawLine(new RawVector2(100, 200), new RawVector2(200, 200), brush, 10, strokeStyleTriangle);
            _renderTarget.EndDraw();
        }
Beispiel #2
0
        private void button4_Click(object sender, EventArgs e)
        {
            var strokeStyleProperties = new D2D.StrokeStyleProperties();

            float[] dashes = { 20, 10 };

            strokeStyleProperties.DashStyle = D2D.DashStyle.Custom;

            //strokeStyleProperties.DashCap = D2D.CapStyle.Square;
            //strokeStyleProperties.DashOffset = 5;
            var strokeStyle = new StrokeStyle(factory, strokeStyleProperties, dashes);

            strokeStyle.GetDashes(dashes, 2);
            var brush = new D2D.SolidColorBrush(_renderTarget, new SharpDX.Mathematics.Interop.RawColor4(0.439F, 0.501F, 0.564F, 1));

            _renderTarget.BeginDraw();
            _renderTarget.Clear(new RawColor4(0.752F, 0.862F, 0752F, 0));
            _renderTarget.DrawLine(new RawVector2(100, 50), new RawVector2(500, 50), brush, 0.5F, strokeStyle);


            _renderTarget.EndDraw();
        }