读书人

请教在WPF的界面下怎么添加分割线呢

发布时间: 2012-08-17 02:08:34 作者: rapoo

请问在WPF的界面上如何添加分割线呢?
请问在WPF的界面上如何添加分割线呢?

[解决办法]

C# code
Rectangle rect = new Rectangle();rect.VerticalAlignment = VerticalAlignment.Top;rect.Height = 1;rect.Width = 300;rect.Height = 300;// 几种方式 你看下rect.Fill = Brushes.Red;rect.Fill = new SolidColorBrush() { Color = Colors.Red, Opacity = 0.8 };rect.SetValue(Rectangle.FillProperty, Brushes.Olive);rect.Fill = new LinearGradientBrush(){    StartPoint = new Point(0, 0),    EndPoint = new Point(0, 1),    GradientStops = new GradientStopCollection()    {        new GradientStop(Colors.Red, 0),        new GradientStop(Colors.Blue, 1)    }};Grid.SetRow(rect, 1);LayoutRoot.Children.Add(rect); 

读书人网 >C#

热点推荐