简体   繁体   中英

Paint Event of Viewport3D

How can I change the rendering of my Viewport3D? Is there a Paint Event like in winforms?

I want to draw some content in screen space (On the viewport) and not in world space (in the viewport). Why? Because it's too heavy to draw text and lines directly in viewport3D. I have hundreds of thousands of lines and text to draw. And even if I use good libraries, it slowes the drawing process and inflates the memory dramatically.

Also, I want to draw a rectangle on the surface of viewport3D regardless of the content. (eg I don't want to calculate where I should draw the rectangle so that it's not behing the objects.)

So drawing on the surface of the viewport3D will be an excellent solution if only I knew how to do it.

You can override the OnRender method of the Viewport3D. Refer below code.

 class MyViewPort : Viewport3D
{
    protected override void OnRender(DrawingContext drawingContext)
    {
        base.OnRender(drawingContext);
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM