WPF 窗体圆角问题 RRS feed

  • 问题

  • 根据需求窗体里 只有一个tabcontrol  

    tabitem里 Content 是一个UserControl  

    如果用<Border CornerRadius="5,5,5,5" Background="#1771d0">做圆角,会直接给UserControl遮盖,请问还有什么好的办法。

    2017年4月11日 7:08


  • Hi 没事养个哈土奇,


     <Grid Background="Transparent">
            <TabControl >
                    <Border  Name="top" BorderThickness="2" BorderBrush="DarkGreen"  SizeChanged="top_SizeChanged">
                            <local:CalendarMatrixusercontrol HorizontalAlignment="Left"  VerticalAlignment="Top"/>
           private void top_SizeChanged(object sender, SizeChangedEventArgs e)
                System.Windows.Rect r = new System.Windows.Rect(e.NewSize);
                RectangleGeometry gm = new RectangleGeometry(r, 10, 10); // 40 is radius here
                ((UIElement)sender).Clip = gm;



    Best Regards,

    Yohann Lu

    MSDN Community Support<br/> Please remember to click &quot;Mark as Answer&quot; the responses that resolved your issue, and to click &quot;Unmark as Answer&quot; if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact <a href=""></a>.

    2017年4月12日 5:40