Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

prevent wpf window render black background without allowstransparency=true

I have some animations on a window that should be overall transparent and stretched over multiple screens. I dont need the title bar or the background. I would like to save resources. When I set allowstransparency(bad for performance) to false the transparent background is rendered black. Is there some lighter alternative to even prevent the window to render the background?

I did not find any thing on alternative rendering or windows. I see the window class inherits from Window : ContentControl, IWindowService but I guess I shouldnt look into that.

I dont have code to show accept at least that im using

<WindowChrome.WindowChrome>
    <WindowChrome 
    CaptionHeight="0"
    ResizeBorderThickness="0" 
        />
</WindowChrome.WindowChrome>

To disable transparency paddings on a loose window without allowstransparency=true.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

One of the things WindowChrome gives you is the ability to add certain Windows window's abilities to a custom design window you make.

Not necessarily related to transparent background.

If you want your window to have round edges you will need to set AllowTranspareny to True, otherwise you will get the black background, no way around that.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...