原文:windows phone 了解LinearGradientBrush类和RadialGradienBrush类(11)
我们了解到在能在xaml中完成的设计,一般在隐藏文件中也可通过代码完成;本节中的案例是实现对同一设计效果的不同写法;例如在隐藏文件中代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
, , , );
gt1.Offset = , , , );
gt2.Offset = , );
lgb2.StartPoint = p1;
, );
lgb2.EndPoint = p2;
" />
</RadialGradientBrush>
</TextBlock.Foreground>
</TextBlock>
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
, , , );
gt1.Offset = , , , );
gt2.Offset = , );
lgb2.StartPoint = p1;
, );
lgb2.EndPoint = p2;
" />
</RadialGradientBrush>
</TextBlock.Foreground>
</TextBlock>
效果图:
径向渐变中的渐变停止点