ChineseLunisolarCalendar
2009-11-27 22:22
453 查看
using System;
using System.Drawing;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace LunisolarCalendar
{
public partial class FormCalendar : Form
{
private readonly string animals, gan, zhi;
private ChineseLunisolarCalendar lunarCalendar;
public FormCalendar()
{
InitializeComponent();
gan = "甲乙丙丁戊己庚辛壬癸";
zhi = "子丑寅卯辰巳午未申酉戌亥";
animals = "鼠牛虎兔龙蛇马羊猴鸡狗猪";
lunarCalendar = new ChineseLunisolarCalendar();
timerInfo = new Timer();
timerInfo.Enabled = true;
timerInfo.Interval = 1000;
timerInfo.Tick += new EventHandler(this.timerInfo_Tick);
}
private void timerInfo_Tick(object sender, EventArgs e)
{
DateTime solar = monthCalendarInfo.SelectionEnd;
int year = lunarCalendar.GetYear(solar);
int month = lunarCalendar.GetMonth(solar);
int leapMonth = lunarCalendar.GetLeapMonth(year);
if (0 < leapMonth && leapMonth <= month)
--month;
this.Text = string.Format("农历 {0}{1}【{2}年】", gan[(year - 4) % 10], zhi[(year - 4) % 12], animals[(year - 4) % 12]);
}
}
}
using System.Drawing;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace LunisolarCalendar
{
public partial class FormCalendar : Form
{
private readonly string animals, gan, zhi;
private ChineseLunisolarCalendar lunarCalendar;
public FormCalendar()
{
InitializeComponent();
gan = "甲乙丙丁戊己庚辛壬癸";
zhi = "子丑寅卯辰巳午未申酉戌亥";
animals = "鼠牛虎兔龙蛇马羊猴鸡狗猪";
lunarCalendar = new ChineseLunisolarCalendar();
timerInfo = new Timer();
timerInfo.Enabled = true;
timerInfo.Interval = 1000;
timerInfo.Tick += new EventHandler(this.timerInfo_Tick);
}
private void timerInfo_Tick(object sender, EventArgs e)
{
DateTime solar = monthCalendarInfo.SelectionEnd;
int year = lunarCalendar.GetYear(solar);
int month = lunarCalendar.GetMonth(solar);
int leapMonth = lunarCalendar.GetLeapMonth(year);
if (0 < leapMonth && leapMonth <= month)
--month;
this.Text = string.Format("农历 {0}{1}【{2}年】", gan[(year - 4) % 10], zhi[(year - 4) % 12], animals[(year - 4) % 12]);
}
}
}
相关文章推荐
- doeNET Framework 农历 ChineseLunisolarCalendar
- [2010-09-20].NET 2.0 C#下利用ChineseLunisolarCalendar类农历的实现
- 使用ChineseLunisolarCalendar类转换公历和农历日期
- ChineseLunisolarCalendar
- ChineseLunisolarCalendar 农历日期
- ASP.Net 的ChineseLunisolarCalendar 农历日期
- Csharp: ChineseLunisolarCalendar class
- C# 公农历算法 ChineseLunisolarCalendar的一点思路
- System.Globalization.ChineseLunisolarCalendar
- Csharp: ChineseLunisolarCalendar class
- 使用ChineseLunisolarCalendar 对象由年份获得生肖名,Datetime.now.tostring获得星期几
- System.Globalization.ChineseLunisolarCalendar
- Csharp: ChineseLunisolarCalendar class .
- Chinese Lunar Calendar for Live Calendar(In progress ...)
- Conver to date time between Chinese and Calendar
- Chinese Lunar Calendar for Live Calendar(In progress ...)
- android Date 和 Calendar
- Calendar 获得当前日期是这一年的第几天
- Java Calendar 基础详解实例
- "Chinese_PRC_90_CI_AS" and "Chinese_PRC_CI_AS"排序规则冲突