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...

  • 相关阅读:
    Windows Server 2003 SP2(32位) 中文版 下载地址 光盘整合方法
    用Recycle()方法对Java对象的重要性
    Lotus中千奇百怪的 $$
    Developing a simple application using steps "User Decision" and "Mail"(1) 沧海
    沟通中的情绪管理(演讲稿) 沧海
    人只有在压力之下,才可能成功,没做一件事,都必须成功,不许言败 沧海
    什么是IDOC,以及IDOC的步骤 沧海
    VS2008 Professional Edition CHS中的deffactory.dat读取错误 沧海
    Including custom text in the step "User Decision" 沧海
    SAP Upgrade Strategy 沧海
  • 原文地址:https://www.cnblogs.com/alex09/p/4452544.html
Copyright © 2011-2022 走看看