簡體   English   中英

WPF Window中如何設置webview2的圓角半徑

[英]How to set the corner radius of webview2 in WPF Window

在我的 WPF 應用程序的 Window 中,我添加了一個webview2並試圖使其邊框變圓。

<Window x:Class="Webview2Experiment.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:Webview2Experiment"
    xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
    mc:Ignorable="d"
    Title="MainWindow" Height="450" Width="400"
    WindowStyle="None"
    AllowsTransparency="True"
    Background="Transparent">
<Border Background = "White"
        Opacity = ".01"
        Margin="0,0,0,0"
        Width="400"
        CornerRadius="22">
    <wv2:WebView2 Name = "webView2" 
                  Width="400"
                  Height="450"
                  />
</Border>

設置BordercornerRadius屬性沒有幫助。 雖然邊框是圓形的,但 webview 的內容在尖角周圍是可見的。

我還嘗試在父 Window 中設置cornerRadius ,並在 Window 和邊框中剪切內容。 每次容器都是圓形的,但 web 的內容在鋒利的邊緣周圍是可見的。

那么,WPF客戶端是否可以達到預期的效果,如何實現呢?

好像暫時不支持。 也許您可以打開指向此評論的功能請求。

暫無
暫無

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

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