基本信息
源码名称:WPF ContentControl派生类TabControl(Items)
源码大小:0.08M
文件格式:.rar
开发语言:C#
更新时间:2021-05-11
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 2 元 
   源码介绍

ListBox,ComboBox,Menu,ProgressBar,Slider的使用

MainWIndow.xaml.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpsItems
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            textBox1.Text = "菜单";
        }

        private void Radio_Checked(object sender, RoutedEventArgs e)
        {
            RadioButton rb = (RadioButton)e.OriginalSource;
            string SelectMode = rb.Name;
            switch(SelectMode)
            {
                case "radioSingle":
                    {
                        lb.SelectionMode = SelectionMode.Single;
                        break;
                    }
                case "radioMultiple":
                    {
                        lb.SelectionMode = SelectionMode.Multiple;
                        break;
                    }
                case "radioExtended":
                    {
                        lb.SelectionMode = SelectionMode.Extended;
                        break;
                    }
                default:
                    break;
            }
        }

        private void Bold_Checked(object sender, RoutedEventArgs e)
        {
            textBox1.FontWeight = FontWeights.Bold;
        }

        private void Bold_UnChecked(object sender, RoutedEventArgs e)
        {
            textBox1.FontWeight = FontWeights.Normal;
        }

        private void Italic_Checked(object sender, RoutedEventArgs e)
        {
            textBox1.FontStyle = FontStyles.Italic;
        }

        private void Italic_UnChecked(object sender, RoutedEventArgs e)
        {
            textBox1.FontStyle = FontStyles.Normal;
        }

        private void IncreaseFont_Click(object sender, RoutedEventArgs e)
        {
            if(textBox1.FontSize < 28)
            {
                textBox1.FontSize = 2;
            }
        }

        private void DecreaseFont_Click(object sender, RoutedEventArgs e)
        {
            if(textBox1.FontSize > 10)
            {
                textBox1.FontSize -= 2;
            }
        }

        private void btnBegin_Click(object sender, RoutedEventArgs e)
        {
            Duration duration = new Duration(TimeSpan.FromSeconds(10));
            DoubleAnimation doub = new DoubleAnimation(100.0, duration);
            progressbar2.BeginAnimation(ProgressBar.ValueProperty, doub);
        }

        private void GSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            Update();
        }

        private void RSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            Update();
        }

        private void BSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            Update();
        }

        private void Update()
        {
            Color color = Color.FromRgb(Convert.ToByte(RSlider.Value), Convert.ToByte(GSlider.Value), Convert.ToByte(BSlider.Value));
            rec.Fill = new SolidColorBrush(color);
        }

    }
}