public SpecialLineRendering()
        {
            InitializeComponent();


            // First create HiddenLineMaterial
            _hiddenLineMaterial = new HiddenLineMaterial()
            {
                LineColor     = Colors.Yellow.ToColor4(),
                LineThickness = 1f,
                LinePattern   = 0x1111,
            };

            // Also create a DXEngine's LineMaterial (it will be used by the ScreenSpaceLineNode and to render wireframe object)
            _dxLineMaterial = new LineMaterial()
            {
                LineThickness = 1,
                LineColor     = Colors.Yellow.ToColor4(),
                DepthBias     = 0.1f
                                // Set DepthBias to prevent rendering wireframe at the same depth as the 3D objects. This creates much nicer 3D lines because lines are rendered on top of 3D object and not in the same position as 3D object.
            };

            CreateTest3DObjects();

            MainDXViewportView.DXSceneInitialized += delegate(object sender, EventArgs args)
            {
                if (MainDXViewportView.DXScene == null)
                {
                    return; // Probably WPF 3D rendering
                }
                CreateSceneNodesDictionary();

                // After the DXScene was initialized and the DXEngine's SceneNodes objects are created,
                // we can set advanced DXEngine properties
                ShowVisibleAndHiddenLines();
            };


            // IMPORTANT:
            // It is very important to call Dispose method on DXSceneView after the control is not used any more (see help file for more info)
            this.Unloaded += delegate
            {
                if (_hiddenLineMaterial != null)
                {
                    _hiddenLineMaterial.Dispose();
                    _hiddenLineMaterial = null;
                }

                if (_dxLineMaterial != null)
                {
                    _dxLineMaterial.Dispose();
                    _dxLineMaterial = null;
                }

                MainDXViewportView.Dispose();
            };
        }
        public SpecialLineRendering()
        {
            InitializeComponent();


            // First create HiddenLineMaterial
            _hiddenLineMaterial = new HiddenLineMaterial()
            {
                LineColor     = Colors.Yellow.ToColor4(),
                LineThickness = 1f, // Use very small line thickness (smaller than 1)
                LinePattern   = 0x1111,
            };

            CreateTest3DObjects();

            MainDXViewportView.DXSceneInitialized += delegate(object sender, EventArgs args)
            {
                CreateSceneNodesDictionary();

                // After the DXScene was initialized and the DXEngine's SceneNodes objects are created,
                // we can set advanced DXEngine properties
                ShowVisibleAndHiddenLines();
            };


            // IMPORTANT:
            // It is very important to call Dispose method on DXSceneView after the control is not used any more (see help file for more info)
            this.Unloaded += delegate
            {
                if (_hiddenLineMaterial != null)
                {
                    _hiddenLineMaterial.Dispose();
                    _hiddenLineMaterial = null;
                }

                if (_dxLineMaterial != null)
                {
                    _dxLineMaterial.Dispose();
                    _dxLineMaterial = null;
                }

                MainDXViewportView.Dispose();
            };
        }