91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 548KB
    文件類型: .7z
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-05-20
  • 語言: C#
  • 標(biāo)簽: WPF??DateTimePick??

資源簡介

一個可以實現(xiàn)年月日時分秒的WPF控件,希望對學(xué)習(xí)WPF的朋友有所幫助!

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Text;
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.Imaging;
using?System.Windows.Navigation;
using?System.Windows.Shapes;
using?System.ComponentModel;

namespace?DateTimePickerControl
{
????public?partial?class?DateTimePicker?:?UserControl?INotifyPropertyChanged
????{
????????public?DateTimePicker()
????????{
????????????InitializeComponent();

????????????DatePickerObj.SelectedDate?=?DateTime.Now;
????????????this.SendPropertyChanged(“SelectedDateTimeString“);

????????????_selectedHour?=?DateTime.Now.Hour;
????????????_selectedMinute?=?DateTime.Now.Minute;
????????????_selectedSecond?=?DateTime.Now.Second;

????????????_oldTextBox?=?_currentTextBox?=?TextBox_Seconds;
????????????_currentTextBox.Background?=?Brushes.Pink;
????????}
????????public?DateTime?SelectedDateTime
????????{
????????????get
????????????{
????????????????DateTime?obj?=?DatePickerObj.SelectedDate????DateTime.Now;
????????????????return?obj.Add(new?TimeSpan(SelectedHour?-?obj.Hour?SelectedMinute?-?obj.Minute?SelectedSecond?-?obj.Second));
????????????}
????????}
????????public?String?SelectedDateTimeString
????????{
????????????get
????????????{
????????????????return?SelectedDateTime.ToString(“yyyy-MM-dd?HH-mm-ss“);
????????????}
????????}

????????#region?private?methods
????????private?void?TextBox_Hours_GotFocus(object?sender?RoutedEventArgs?e)
????????{
????????????_oldTextBox.Background?=?Brushes.Transparent;
????????????_oldTextBox?=?_currentTextBox?=?TextBox_Hours;
????????????_currentTextBox.Background?=?Brushes.Pink;
????????}
????????private?void?TextBox_Minutes_GotFocus(object?sender?RoutedEventArgs?e)
????????{
????????????_oldTextBox.Background?=?Brushes.Transparent;
????????????_oldTextBox?=?_currentTextBox?=?TextBox_Minutes;
????????????_currentTextBox.Background?=?Brushes.Pink;
????????}
????????private?void?TextBox_Seconds_GotFocus(object?sender?RoutedEventArgs?e)
????????{
????????????_oldTextBox.Background?=?Brushes.Transparent;
????????????_oldTextBox?=?_currentTextBox?=?TextBox_Seconds;
????????????_currentTextBox.Background?=?Brushes.Pink;
????????}
????????private?void?ComboBox_DropDownClosed(object?sender?EventArgs?e)
????????{
????????????this.SendPropertyChanged(“SelectedDateTime“);
????????????this.SendPropertyChanged(“SelectedDateTimeString“);
????????}

????????private?void?BTN_IncreaseTime_Click(object?sender?RoutedEventArgs?e)
????????{
????????????Int32?result;
????????????if?(Int32.TryParse(_currentTextBox.Text?out?result))
????????????{
????????????????result++;
????????????????_currentTextBox.Text?=?result.ToString();
????????????}
????????}
????????private?void?BTN_DecrementTime_Click(object?sender?RoutedEventArgs?e)
???

評論

共有 條評論