资源简介
wpf led时钟 指针时钟,原创。

代码片段和文件信息
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.Windows.Threading;
namespace Clock
{
///
/// Follow steps 1a or 1b and then 2 to use this custom control in a XAML file.
///
/// Step 1a) Using this custom control in a XAML file that exists in the current project.
/// Add this xmlNamespace attribute to the root element of the markup file where it is
/// to be used:
///
/// xmlns:MyNamespace=“clr-namespace:Clock“
///
///
/// Step 1b) Using this custom control in a XAML file that exists in a different project.
/// Add this xmlNamespace attribute to the root element of the markup file where it is
/// to be used:
///
/// xmlns:MyNamespace=“clr-namespace:Clock;assembly=Clock“
///
/// You will also need to add a project reference from the project where the XAML file lives
/// to this project and Rebuild to avoid compilation errors:
///
/// Right click on the target project in the Solution Explorer and
/// “Add Reference“->“Projects“->[Browse to and select this project]
///
///
/// Step 2)
/// Go ahead and use your control in the XAML file.
///
///
///
///
public class MyClock : Control
{
static MyClock()
{
DefaultstyleKeyProperty.Overridemetadata(typeof(MyClock) new frameworkPropertymetadata(typeof(MyClock)));
}
private DispatcherTimer timer; // NameSpace:System.Windows.Threading
//重载初始化函数OnInitialized,加入初始化计时器代码
protected override void OnInitialized(EventArgs e)
{
base.OnInitialized(e);
UpdateDateTime();
timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromMilliseconds(1000);
timer.Tick += new EventHandler(timer_Tick);
timer.Start();
}
//计时器事件函数
private void timer_Tick(object sender EventArgs e)
{
UpdateDateTime();
}
//编写UpdateDateTime函数,用于更新时间
private void UpdateDateTime()
{
Time = DateTime.Now;
}
public DateTime Time
{
get { return (DateTime)GetValue(TimeProperty); }
private set { SetValue(TimeProperty value); }
}
public static DependencyProperty TimeProperty = DependencyProperty.Register(
“Time“ typeof(DateTime)
typeof(MyClock)
new Propertymetadata(DateTime.Now new PropertyChangedCallback(OnDateTimeInvalidated)));
private
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 9216 2012-08-20 15:34 Clock\Clock\bin\Debug\Clock.dll
文件 28160 2012-08-20 15:34 Clock\Clock\bin\Debug\Clock.pdb
文件 3820 2011-07-20 11:05 Clock\Clock\Clock.csproj
文件 4027 2011-07-20 11:05 Clock\Clock\MyClock.cs
文件 1605 2011-11-18 10:54 Clock\Clock\obj\Debug\Clock.csproj.FileListAbsolute.txt
文件 9216 2012-08-20 15:34 Clock\Clock\obj\Debug\Clock.dll
文件 1364 2012-08-20 15:34 Clock\Clock\obj\Debug\Clock.g.resources
文件 28160 2012-08-20 15:34 Clock\Clock\obj\Debug\Clock.pdb
文件 180 2011-11-18 10:54 Clock\Clock\obj\Debug\Clock.Properties.Resources.resources
文件 187 2012-08-20 15:34 Clock\Clock\obj\Debug\Clock_MarkupCompile.cache
文件 187 2012-08-20 15:33 Clock\Clock\obj\Debug\Clock_MarkupCompile.i.cache
文件 139 2012-08-20 15:33 Clock\Clock\obj\Debug\Clock_MarkupCompile.i.lref
文件 137 2012-08-20 15:34 Clock\Clock\obj\Debug\Clock_MarkupCompile.lref
文件 15146 2012-01-13 14:27 Clock\Clock\obj\Debug\DesignTimeResolveAssemblyReferences.cache
文件 6299 2012-08-20 15:34 Clock\Clock\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 7 2012-08-20 15:34 Clock\Clock\obj\Debug\GeneratedInternalTypeHelper.g.cs
文件 2905 2012-08-20 15:34 Clock\Clock\obj\Debug\GeneratedInternalTypeHelper.g.i.cs
文件 220 2011-11-18 10:54 Clock\Clock\obj\Debug\GenerateResource.read.1.tlog
文件 518 2011-11-18 10:54 Clock\Clock\obj\Debug\GenerateResource.write.1.tlog
文件 757 2011-07-20 11:06 Clock\Clock\obj\Debug\JClock.csproj.FileListAbsolute.txt
文件 4608 2011-07-20 11:05 Clock\Clock\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
文件 1128 2012-08-20 15:34 Clock\Clock\obj\Debug\Themes\Generic.baml
文件 2288 2011-07-20 08:52 Clock\Clock\Properties\AssemblyInfo.cs
文件 2834 2011-07-20 11:05 Clock\Clock\Properties\Resources.Designer.cs
文件 5612 2011-07-20 08:52 Clock\Clock\Properties\Resources.resx
文件 1084 2011-07-20 11:05 Clock\Clock\Properties\Settings.Designer.cs
文件 201 2011-07-20 08:52 Clock\Clock\Properties\Settings.settings
文件 1468 2011-07-20 13:25 Clock\Clock\Themes\Generic.xaml
文件 3529 2011-07-21 12:26 Clock\Clock.sln
..A..H. 84480 2012-08-20 15:35 Clock\Clock.suo
............此处省略137个文件信息
- 上一篇:C#调用API实现录音功能
- 下一篇:NGUI实现Tab键切换Input焦点
相关资源
- EQ2008LEDc#开发实例
- 用WPF开发的多人聊天室 语言C#
- WPF控件库HandyControl
- WPF
- c# wpf实现的上位机
- C#实现Led指示灯(自定义用户控件)
- VisionPro控件在WPF 应用
- WPF使用MVVM
- 灵信LED开发
- winform实现饼状图、柱状图、折线图(
- C#中WPF联合Halcon的一个学习(解决内存
- WPF CEFSHARP 支持 MP4
- WPF贝塞尔曲线
- WPF 简单控件集
- WPF鼠标拖动控件源码
- wpf开发教程
- AduMusic迷你音乐盒WPF源码
- WPF PDF封装(放大、缩小、单页、双页
- C# .NET5.0(net core)基于WPF(XAML)开发
- WPF MVVM 基础入门
- wpf echart
- windorm 加载WPF控件 ,实现dxf文件显示
- WPF Control Development
- wpf Dock window
- WPF 隐蔽查看股票行情工具
- WPF控件库(HandyControl)
- 别踩白块wpf 源码
- WPF贪吃蛇
- WPF Task 多任务
- WPF path动画
评论
共有 条评论