資源簡介
福建莆田第十中學(xué)徐建偉大師java版壽星萬年歷精準(zhǔn)而信息全面,網(wǎng)上大神翻譯為C#版。但經(jīng)過測試,俺發(fā)現(xiàn)有一點瑕疵:公元前721年至公元前104年輸入會報錯,對照原版Java程序,進(jìn)行了一點修改。

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;
using?SharpSxwnl;
using?System.IO;
using?System.Globalization;
using?System.Text.Regularexpressions;
using?System.xml;
namespace?TestSharpSxwnl
{
????public?partial?class?frmMain?:?Form
????{
????????Lunar?lun?=?new?Lunar();
????????double?curJD?curTZ;
????????sun_moon?smc?=?new?sun_moon();
????????string?TempPath?=?““;
????????public?frmMain()
????????{
????????????InitializeComponent();
????????}
????????#region?初始化?顯示當(dāng)前日期所在月的月歷
????????private?void?frmMainTest_Load(object?sender?EventArgs?e)
????????{
????????????this.TempPath?=?this.AddBS(Environment.GetEnvironmentVariable(“Temp“));
????????????this.cmbBaziTypeS.SelectedIndex?=?0;
????????????DateTime?nowDT?=?DateTime.Now;
????????????this.curTZ?=?TimeZone.CurrentTimeZone.GetUtcOffset(nowDT).Negate().TotalHours;?????//?中國:?東?8?區(qū)
????????????this.curJD?=?LunarHelper.NowUTCmsSince19700101(nowDT)?/?86400000d?-?10957.5?-?this.curTZ?/?24d;?//J2000起算的儒略日數(shù)(當(dāng)前本地時間)
????????????JD.setFromJD(this.curJD?+?LunarHelper.J2000);
????????????this.Caly_y.Text?=?JD.Y.ToString();
????????????this.Cml_y.Text?=?JD.Y.ToString();
????????????this.Cml_m.Text?=?JD.M.ToString();
????????????this.Cml_d.Text?=?JD.D.ToString();
????????????this.Cml_his.Text?=?JD.h?+?“:“?+?JD.m?+?“:“?+?JD.s.ToString(“F0“).PadLeft(2?‘0‘);
????????????this.Cal_y.Text?=?JD.Y.ToString();
????????????this.Cal_m.Text?=?JD.M.ToString();
????????????this.curJD?=?LunarHelper.int2(this.curJD?+?0.5);
????????????this.InitComboBoxes();
????????????this.ML_calc(BaZiType.ZtyBaZi);
????????????this.getlunar();
????????????this.timerTick.Enabled?=?true;
????????????this.showClockAndSunMoonInfo();
????????}
????????#endregion
????????#region?生成和顯示月歷
????????private?void?btnGo_Click(object?sender?EventArgs?e)
????????{
????????????this.getlunar();
????????}
????????private?void?getlunar()
????????{
????????????double?By?=?LunarHelper.year2Ayear(this.Cal_y.Text);
????????????////?C#:?注:?使用上句也可以?如果在調(diào)用泛型方法時?不指定類型?C#?編譯器將自動推斷其類型
????????????//double?By?=?LunarHelper.year2Ayear(this.Cal_y.Text);????//?自動推斷類型為:?string?
????????????double?Bm?=?int.Parse(this.Cal_m.Text);
????????????lun.yueLiHTML((int)By?(int)Bm?this.curJD);
????????????this.txtPg0_Text.Text?=?lun.pg0_text;
????????????this.txtPg1_Text.Text?=?lun.pg1_text;
????????????this.txtPg2_Text.Text?=?lun.pg2_text;
????????????this.showMessD(-2);
????????????this.StrToFile(“ta?http-equiv=Content-Type?content=‘text/html;?charset=utf-8‘>“?+?lun.pg0?+
???????????????????????????““?+?lun.pg1?+?““?+?lun.pg2?+
???????????????????????????“\r\n?ript?language=‘javascript‘>“?+
???????????????????????????“\r\n?function?changeBackcolor(oTdOfDay?setBackcolor)?{“?+
???????????????????????????“\r\n?if(oTdOfDay?==?n
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????5732??2014-06-24?23:14??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\AppSharpSxwnl.csproj
?????文件????????453??2014-06-24?16:17??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\AppSharpSxwnl.csproj.user
?????文件?????595968??2014-06-26?16:46??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\bin\Release\AppSharpSxwnl.exe
?????文件??????62976??2014-06-26?16:46??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\bin\Release\AppSharpSxwnl.pdb
?????文件??????22704??2014-06-26?10:14??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\bin\Release\AppSharpSxwnl.vshost.exe
?????文件????????490??2010-03-17?22:39??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\bin\Release\AppSharpSxwnl.vshost.exe.manifest
?????文件?????122880??2014-06-26?16:46??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\bin\Release\SharpSxwnl.dll
?????文件?????138752??2014-06-26?16:46??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\bin\Release\SharpSxwnl.pdb
?????文件??????76594??2009-04-23?11:26??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\bin\Release\SharpSxwnl.xm
?????文件?????270398??2014-06-24?23:19??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\calendar?(2).ico
?????文件??????40204??2014-06-25?14:47??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\frmMain.cs
?????文件??????36803??2014-06-24?23:21??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\frmMain.Designer.cs
?????文件?????412082??2014-06-24?23:21??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\frmMain.resx
?????文件???????6690??2014-06-24?22:10??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\frmMethods.cs
?????文件??????17370??2014-06-24?22:10??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\frmMethods.Designer.cs
?????文件???????5814??2009-04-16?21:15??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\frmMethods.resx
?????文件???????6020??2014-06-26?15:26??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\obj\Release\AppSharpSxwnl.csproj.FileListAbsolute.txt
?????文件????????912??2014-06-26?15:26??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\obj\Release\AppSharpSxwnl.csproj.GenerateResource.Cache
?????文件???????6331??2014-06-26?16:46??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\obj\Release\AppSharpSxwnl.csprojResolveAssemblyReference.cache
?????文件?????595968??2014-06-26?16:46??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\obj\Release\AppSharpSxwnl.exe
?????文件??????62976??2014-06-26?16:46??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\obj\Release\AppSharpSxwnl.pdb
?????文件????????180??2014-06-26?16:46??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\obj\Release\AppSharpSxwnl.Properties.Resources.resources
?????文件????????791??2014-06-24?16:37??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\obj\Release\DesignTimeResolveAssemblyReferences.cache
?????文件???????6466??2014-06-26?16:46??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\obj\Release\DesignTimeResolveAssemblyReferencesInput.cache
?????文件???????4608??2014-06-24?23:12??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\obj\Release\TempPE\Properties.Resources.Designer.cs.dll
?????文件???????1313??2014-06-24?16:14??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\obj\Release\TestSharpSxwnl.csproj.FileListAbsolute.txt
?????文件????????920??2014-06-24?16:14??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\obj\Release\TestSharpSxwnl.csproj.GenerateResource.Cache
?????文件???????6307??2014-06-24?16:14??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\obj\Release\TestSharpSxwnl.csprojResolveAssemblyReference.cache
?????文件?????270964??2014-06-26?16:46??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\obj\Release\TestSharpSxwnl.frmMain.resources
?????文件????????180??2014-06-24?17:51??SharpSxwnl-vs2013-v1.0\AppSharpSxwnl\obj\Release\TestSharpSxwnl.frmMainTest.resources
............此處省略126個文件信息
評論
共有 條評論