扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:轩辕南宫 来源:天极开发 2007年11月3日
关键字:
36 <Button 37 Width="100" 38 Name="myButton" 39 Height="20" 40 Content="This is my button" /> |
41 Button myButton; 42 myButton.Width=100; 43 myButton.Height=20; 44 myButton.Content = "This is my button"; |
45 <Rectangle 46 Width="200" 47 Height="100" 48 Stroke="Red" 49 Fill="Yellow" /> |
图3-3 带渐变效果的Button元素 |
01 <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 02 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> 03 <Button Width="200" Height="100"> 04 <Button.Background> 05 <SolidColorBrush Color="Blue" /> 06 </Button.Background> 07 Click me 08 </Button> 09 </Page> |
01 Button btn = new Button( ); 02 SolidColorBrush brush = new SolidColorBrush( ); 03 brush.Color = Colors.Blue; 04 btn.Background = brush; 05 btn.AddText("Click me"); |
01 <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 02 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> 03 <Button 04 Width="200" 05 Height="100" 06 Background="Blue"> 07 </Button> 08 </Page> |
01 <Button VerticalAlignment="Center" HorizontalAlignment="Center"> 02 <Button.Background> 03 <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> 04 <LinearGradientBrush.GradientStops> 05 <GradientStop Offset="0" Color="Yellow" /> 06 <GradientStop Offset="0.35" Color="Red" /> 07 <GradientStop Offset="1" Color="Green" /> 08 </LinearGradientBrush.GradientStops> 09 </LinearGradientBrush> 10 </Button.Background> 11 Click me 12 </Button> |
01 Button b = new Button( ); 02 b.VerticalAlignment = VerticalAlignment.Center; 03 b.HorizontalAlignment = HorizontalAlignment.Center; 04 LinearGradientBrush brush = new LinearGradientBrush( ); 05 brush.StartPoint = new Point(0,0); 06 brush.EndPoint = new Point(0,1); 07 GradientStop gs = new GradientStop( ); 08 gs.Offset = 0; 09 gs.Color = Color.FromRgb(0x80, 0, 0); 10 brush.GradientStops.AddChild(gs); 11 gs = new GradientStop( ); 12 gs.Offset = 0.35; 13 gs.Color = Colors.Red; 14 brush.GradientStops.AddChild(gs); 15 gs = new GradientStop( ); 16 gs.Offset = 0.35; 17 gs.Color = Color.FromRgb(0x50, 0, 0); 18 brush.GradientStops.AddChild(gs); 19 b.Background = brush; 20 b.AddText("Click me"); |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者