@H_403_7@
xaml代码:
<GrID x:name="LayoutRoot" Background="White">
<GrID.ColumnDeFinitions>
<ColumnDeFinition WIDth="260">
</ColumnDeFinition>
<ColumnDeFinition WIDth="400"></ColumnDeFinition>
</GrID.ColumnDeFinitions>
<GrID.RowDeFinitions>
<RowDeFinition Height="120">
</RowDeFinition>
<RowDeFinition Height="120"></RowDeFinition>
</GrID.RowDeFinitions>
<Rectangle GrID.Row="0" GrID.Column="1" x:name="PrevIEwcolor" Fill="#FF6600" margin="10" stroke="#666666" strokeThickness="2"></Rectangle>
<StackPanel GrID.Row="1" GrID.Column="1">
<TextBlock FontSize="12">color</TextBlock>
<TextBox x:name="Hexcolor" WIDth="160" Height="30" Text="#FF6600" margin="10,5" FontSize="11"></TextBox>
</StackPanel>
<StackPanel GrID.Row="0" GrID.Column="0" GrID.rowspan="2" VerticalAlignment="Center">
<TextBlock Text="Alpha" FontSize="12" margin="10,15,0"></TextBlock>
<SlIDer x:name="AlphaSlIDer" margin="20,10,0" Maximum="255" Value="255" ValueChanged="AlphaSlIDer_ValueChanged"></SlIDer>
<TextBlock Text="Red" FontSize="12" margin="10,0"></TextBlock>
<SlIDer x:name="RedSlIDer" margin="20,0" Maximum="255" Value="255" ValueChanged="RedSlIDer_ValueChanged"></SlIDer>
<TextBlock Text="Green" FontSize="12" margin="10,0"></TextBlock>
<SlIDer x:name="GreenSlIDer" margin="20,0" Maximum="255" Value="102" ValueChanged="GreenSlIDer_ValueChanged"></SlIDer>
<TextBlock Text="Blue" FontSize="12" margin="10,0"></TextBlock>
<SlIDer x:name="BlueSlIDer" margin="20,0" Maximum="255" Value="0" ValueChanged="BlueSlIDer_ValueChanged"></SlIDer>
</StackPanel>
</GrID>
xaml.cs代码:
#region 初始化界面
public GrIDcolor()
{
InitializeComponent();
//重新注册AlphaSlIDer_ValueChanged
this.AlphaSlIDer.ValueChanged += new RoutedPropertyChangedEventHandler<double>(AlphaSlIDer_ValueChanged);
//重新注册RedSlIDer_ValueChanged
this.RedSlIDer.ValueChanged += new RoutedPropertyChangedEventHandler<double>(RedSlIDer_ValueChanged);
//重新注册RedSlIDer_ValueChanged
this.GreenSlIDer.ValueChanged += new RoutedPropertyChangedEventHandler<double>(GreenSlIDer_ValueChanged);
//重新注册RedSlIDer_ValueChanged
this.BlueSlIDer.ValueChanged += new RoutedPropertyChangedEventHandler<double>(BlueSlIDer_ValueChanged);
}
/// <summary>
/// 功能描述:调整调色器显示颜色,并显示调整后的颜色值
/// </summary>
private voID mm_Adjustcolor()
{
if (AlphaSlIDer==null||RedSlIDer==null||GreenSlIDer==null||BlueSlIDer==null)
{
return;
}
color color = color.FromArgb((byte)AlphaSlIDer.Value,(byte)RedSlIDer.Value,(byte)GreenSlIDer.Value,(byte)BlueSlIDer.Value);
PrevIEwcolor.Fill = new SolIDcolorBrush(color);
Hexcolor.Text = color.ToString();
}
#endregion
#region 主界面 *** 作
// 当用户导航到此页面时执行。
protected overrIDe voID OnNavigatedTo(NavigationEventArgs e)
{
}
/// <summary>
/// 功能描述:改变红色
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private voID RedSlIDer_ValueChanged(object sender,RoutedPropertyChangedEventArgs<double> e)
{
mm_Adjustcolor();
}
/// <summary>
/// 功能描述:改变原色
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private voID AlphaSlIDer_ValueChanged(object sender,RoutedPropertyChangedEventArgs<double> e)
{
mm_Adjustcolor();
}
/// <summary>
/// 功能描述:改变绿色
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private voID GreenSlIDer_ValueChanged(object sender,RoutedPropertyChangedEventArgs<double> e)
{
mm_Adjustcolor();
}
/// <summary>
/// 功能描述:改变蓝色
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private voID BlueSlIDer_ValueChanged(object sender,RoutedPropertyChangedEventArgs<double> e)
{
mm_Adjustcolor();
} #endregion
总结以上是内存溢出为你收集整理的SilverLight调色器全部内容,希望文章能够帮你解决SilverLight调色器所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)