zoukankan      html  css  js  c++  java
  • WPF学习之路(十二)控件(Range控件)

    ProgressBar

    进度条,主要属性:MinimumMaximunValue, IsIndeterminate为True时,进度条会循环运转

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center">
            <ProgressBar Name="pb1" Height="20" Width="200" Foreground="LightBlue" IsIndeterminate="True"></ProgressBar>
        </StackPanel>
        <StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center">
            <ProgressBar Name="pb2" Height="20" Width="200" Foreground="LightBlue"></ProgressBar>
            <Button Name="btn" MaxWidth="50" Margin="5" Click="BTN_Click">Start</Button>
        </StackPanel>
    </Grid>
    private void BTN_Click(object sender, RoutedEventArgs e)
    {
        Duration duration = new Duration(TimeSpan.FromSeconds(10));
        DoubleAnimation doubleAnimation = new DoubleAnimation(100, duration);
        pb2.BeginAnimation(ProgressBar.ValueProperty, doubleAnimation);
    }

    更多内容

    http://www.codeproject.com/Articles/38555/WPF-ProgressBar

    http://blog.csdn.net/tcjiaan/article/details/6963687

    Silder

    很常见的滑块,控件的外观上显示一系例刻度值,并存在一个可以被拖动的滑块,用户可以通过拖动滑块来控制控件的值

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Rectangle Grid.Column="0" x:Name="rect" Fill="Black"></Rectangle>
        <StackPanel Grid.Column="1">
            <StackPanel Orientation="Horizontal" Margin="10,2,5,2" >
                <TextBlock Text="R" Margin="5,1,1,1" VerticalAlignment="Center"></TextBlock>
                <Slider Name="RSlider" Margin="5" Minimum="0" Maximum="255" TickFrequency="10" Ticks="0,50,100,150,200,250"
                        TickPlacement="BottomRight" IsSnapToTickEnabled="False" ValueChanged="RSlider_ValueChanged" MinWidth="220"></Slider>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Margin="10,2,5,2" >
                <TextBlock Text="G" Margin="5,1,1,1" VerticalAlignment="Center"></TextBlock>
                <Slider Name="GSlider" Margin="5" Minimum="0" Maximum="255" TickFrequency="10" Ticks="0,50,100,150,200,250"
                        TickPlacement="BottomRight" IsSnapToTickEnabled="False" ValueChanged="GSlider_ValueChanged" MinWidth="220"></Slider>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Margin="10,2,5,2" >
                <TextBlock Text="B" Margin="5,1,1,1" VerticalAlignment="Center"></TextBlock>
                <Slider Name="BSlider" Margin="5" Minimum="0" Maximum="255" TickFrequency="10" Ticks="0,50,100,150,200,250"
                        TickPlacement="BottomRight" IsSnapToTickEnabled="False" ValueChanged="BSlider_ValueChanged" MinWidth="220"></Slider>
            </StackPanel>
        </StackPanel>
    </Grid>
    private void RSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
            {
                Update();
            }
    
            private void BSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
            {
                Update();
            }
    
            private void GSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
            {
                Update();
            }
    
            private void Update()
            {
                Color color = Color.FromRgb(Convert.ToByte(RSlider.Value), Convert.ToByte(BSlider.Value), Convert.ToByte(GSlider.Value));
                rect.Fill = new SolidColorBrush(color);
            }

    更多内容

    http://blog.csdn.net/tcjiaan/article/details/6997900

    To be continue...

  • 相关阅读:
    高频交易程序竟然是饿罗斯人开发的?
    系统功能在用户测试阶段被推翻
    去新华书店有感
    金桔
    结香
    金钟花
    金丝桃
    箬竹
    香茶菜
    水果兰
  • 原文地址:https://www.cnblogs.com/alex09/p/4452544.html
Copyright © 2011-2022 走看看