簡體   English   中英

如何設置WPF窗口的透明顏色?

[英]How to set transparency color of the WPF Window?

有沒有辦法將一種特定的顏色設置為對整個WPF窗口透明?

不用了 WPF中的透明度無法像Winforms中那樣使用蒙版顏色工作-只需將背景設置為“透明”,並將AllowsTransparency設置為true。 如果要使用其他形狀的窗口,可以使用此處介紹的技術: http : //devintelligence.com/2007/10/shaped-windows-in-wpf/

我們可以使用如下所示的XAML來創建透明的WPF窗口

<Window x:Class="SeeThru.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="SeeThru" Height="300" Width="300"
    WindowStyle="None" AllowsTransparency="True"
    Background="Transparent">
......
</Window>

不。WPF支持Alpha通道透明度,不支持位圖蒙版透明度。

有些人嘗試解決此問題 ,但僅基於每個圖像。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM