开源项目《一张数字图片显示日月历及日期提醒特定图片》

《微佛诞提示日历时间发布》已经优化代码,软件下载:链接:https://pan.baidu.com/s/1spR1xoI_ACFpLPalQNMVQg 
提取码:r9zz 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;//c#在桌面中绘图 https://www.cnblogs.com/kq2012/articles/2707701.html
using Microsoft.VisualBasic.FileIO;//首先对项目添加名为Microsoft.VisualBasic.dll的引用,然后添加命名空间 https://bbs.csdn.net/topics/390835339 https://www.cnblogs.com/lazycoding/archive/2012/09/25/2702007.html
using 农历引用;
using System.Globalization;
 
 
 
 
namespace 微佛诞提示日历时间
{
    public partial class 微佛诞提示日历时间 : Form
    {
        private class 佛诞
        {
            public string 名称 { get; set; }
            public string 月日 { get; set; }
            public 佛诞(string 称号, string 圣诞)
            { 名称 = 称号; 月日 = 圣诞; }
        }
        佛诞[] 佛诞组 = new 佛诞[] { new 佛诞("那摩阿弥陀佛!圣诞", "11, 17"), new 佛诞("那摩地藏王菩萨!圣诞", "7, 29")
        , new 佛诞("那摩地藏王菩萨!圣诞", "7, 30"), new 佛诞("那摩释迦牟尼佛!圣诞", "4, 8"), new 佛诞("那摩释迦牟尼佛!出家", "2, 8")
        , new 佛诞("那摩释迦牟尼佛!成道", "12, 8"), new 佛诞("那摩释迦牟尼佛!涅槃", "2, 15")
        , new 佛诞("那摩观世音菩萨!圣诞", "2, 19"), new 佛诞("那摩观世音菩萨!出家", "9, 19"), new 佛诞("那摩观世音菩萨!成道", "6, 19")
        , new 佛诞("那摩大势至菩萨!圣诞", "7, 13"), new 佛诞("那摩普贤菩萨!圣诞", "2, 21"), new 佛诞("那摩文殊师利菩萨!圣诞", "4, 4")
        , new 佛诞("那摩禅宗达摩祖师!圣诞", "10, 5"), new 佛诞("那摩慧能禅宗六祖!圣诞", "2, 9"), new 佛诞("那摩慧能禅宗六祖!圆寂", "8, 3")
        , new 佛诞("那摩华严菩萨!圣诞", "12, 29"), new 佛诞("那摩药师佛!圣诞", "9, 30"), new 佛诞("那摩燃灯古佛!圣诞", "8, 22")
        , new 佛诞("那摩定光佛!圣诞", "1, 6"), new 佛诞("那摩弥勒菩萨!圣诞;春节", "1, 1"), new 佛诞("那摩福德土地正神!圣诞", "2, 2")
        , new 佛诞("那摩准提菩萨!圣诞", "3, 16"), new 佛诞("那摩药王菩萨!圣诞", "4, 28"), new 佛诞("那摩伽蓝菩萨!圣诞", "5, 18")
        , new 佛诞("那摩韦驮菩萨!圣诞", "6, 3"), new 佛诞("那摩第五殿阎罗天子!圣诞", "1, 8"), new 佛诞("那摩帝释天尊!圣诞", "1, 9")
        , new 佛诞("那摩妈祖升仙!重阳节", "7, 29"), new 佛诞("那摩妈祖!圣诞", "3, 23"), new 佛诞("那摩文昌帝君!圣诞", "2, 3")
        , new 佛诞("那摩第四殿五官王!圣诞", "2, 18"), new 佛诞("那摩第六殿卞城王!圣诞", "3, 8"), new 佛诞("那摩中岳大帝;后土娘娘!圣诞", "3, 19")
        , new 佛诞("那摩子孙娘娘!圣诞", "3, 20"), new 佛诞("那摩第七殿泰山王!圣诞", "3, 27"), new 佛诞("春龙节(龙抬头)", "2, 2")
        , new 佛诞("佛欢喜日!盂兰盆节", "7, 15"), new 佛诞("元宵节!", "1, 15"), new 佛诞("端午节", "5, 5"), new 佛诞("七夕情人节", "7, 7")
        , new 佛诞("中秋节", "8, 15"), new 佛诞("重阳节 ", "9, 9")
        , new 佛诞("腊八节", "12, 8"), new 佛诞("小年", "12, 23"), new 佛诞("除夕", "12, 30"), new 佛诞("道教中元节", "7, 15")};
        佛诞[] 圣号 = new 佛诞[] { };
        //internal enum 节令 { 小寒, 立春, 惊蛰, 清明, 立夏, 芒种, 小暑, 立秋, 白露, 寒露, 立冬, 大雪 }
        //internal enum 中气 { 冬至, 大寒, 雨水, 春分, 谷雨, 小满, 夏至, 大暑, 处暑, 秋分, 霜降, 小雪 }
        DataTable 定时提醒表 = new DataTable();
        ToolTip 控件说明 = new ToolTip();
        NotifyIcon 托盘 = new NotifyIcon();
        System.Timers.Timer 定时 = new System.Timers.Timer(1000);
        System.Globalization.ChineseLunisolarCalendar 微软农历 = new System.Globalization.ChineseLunisolarCalendar();
        int 循环 = 0, 天 = 0, 月 = 0, 年 = 0;
        string[] 提醒日 = { };
        int[][] 图0坐标 = new int[][] { new int[] { 180, 200 }, new int[] { 10, 0 }, new int[] { 175, 0 }, new int[] { 175 * 2 - 20, 0 }, new int[] { 175 * 3 - 25, 0 }, new int[] { 175 * 4 - 25, 0 }, new int[] { 0, 230 }, new int[] { 175 + 10, 230 }, new int[] { 175 * 2 + 10, 230 }, new int[] { 175 * 3 + 10, 230 }, new int[] { 175 * 4 - 5, 230 } },
            //图1坐标 = new int[][] { new int[] { 150, 200 }, new int[] { 10, 5 }, new int[] { 130, 5 }, new int[] { 130 * 2, 5 }, new int[] { 130 * 3 - 10, 5 }, new int[] { 130 * 4 - 10, 5 }, new int[] { 10, 195 }, new int[] { 130, 195 }, new int[] { 130 * 2 - 10, 195 }, new int[] { 130 * 3 - 10, 195 }, new int[] { 130 * 4 - 15, 195 } },
                图4坐标 = new int[][] { new int[] { 180, 270 }, new int[] { 185 * 4 + 25, 275 }, new int[] { 10, 5 }, new int[] { 185 + 5, 5 }, new int[] { 185 * 2 + 5, 5 }, new int[] { 185 * 3 + 10, 5 }, new int[] { 185 * 4 + 10, 5 }, new int[] { 25, 275 }, new int[] { 185 + 15, 275 }, new int[] { 185 * 2 + 10, 275 }, new int[] { 185 * 3 + 25, 275 } },
                图5坐标 = new int[][] { new int[] { 140, 185 }, new int[] { 150 * 4, 220 }, new int[] { 0, 10 }, new int[] { 140, 10 }, new int[] { 150 * 2, 10 }, new int[] { 150 * 3 - 10, 10 }, new int[] { 150 * 4, 10 }, new int[] { 0, 220 }, new int[] { 150 - 15, 220 }, new int[] { 150 * 2, 220 }, new int[] { 150 * 3 - 5, 220 } };
        //图2坐标 = new int[][] { new int[] { 170, 170 }, new int[] { 5, 5 }, new int[] { 170 + 5, 5 }, new int[] { 170 * 2 + 5, 5 }, new int[] { 170 * 3 + 10, 5 }, new int[] { 170 * 4 + 10, 5 }, new int[] { 5, 210 }, new int[] { 170 + 5, 210 }, new int[] { 170 * 2 + 5, 210 }, new int[] { 170 * 3 + 5, 210 }, new int[] { 170 * 4 + 5, 210 } },
        //图3坐标 = new int[][] { new int[] { 220, 240 }, new int[] { 5, 5 }, new int[] { 210, 5 }, new int[] { 210 * 2 - 20, 5 }, new int[] { 210 * 3 - 30, 5 }, new int[] { 210 * 4 - 50, 5 }, new int[] { 0, 270 }, new int[] { 210, 270 }, new int[] { 210 * 2 - 20, 270 }, new int[] { 210 * 3 - 40, 270 }, new int[] { 210 * 4 - 50, 270 } };
        static bool 控图 = true;
        public 微佛诞提示日历时间()
        {
            InitializeComponent(); //this.KeyPreview = true;/*屏保*/
            托盘.Visible = true;
            托盘.Icon = this.Icon = new Icon(@System.Environment.CurrentDirectory + "\\佛像\\八卦.ico");
            托盘.Text = "微佛诞图片提示日月历时间,从这里开始!";
        }
        void 加载日期时间控件()
        {
            PictureBox xin = new PictureBox();
            foreach (char kj in "12345678ABCDEFGH")
            {
                xin = new PictureBox();
                xin.Parent = this;
                xin.Name = kj.ToString();
                xin.BorderStyle = BorderStyle.Fixed3D;
                xin.Size = new System.Drawing.Size(50, 100);
                if ("68DFH".Contains(xin.Name)) xin.Click += new EventHandler(图片单击);//控制选定事件:8设置开机启动,6设置时间提醒,D设置年提醒,F设置月提醒,H设置日期提醒
                if ("12345678".Contains(kj))
                {
                    xin.Image = 选图区域(@System.Environment.CurrentDirectory + "\\数字\\数字0.jpg", 图0坐标[++循环][0], 图0坐标[循环][1], 图0坐标[0][0], 图0坐标[0][1], xin.Width, xin.Height);
                    xin.Location = new Point(xin.Width * (int.Parse(kj.ToString()) - 1) + 5 * int.Parse(kj.ToString()), 5);
                }
                if ("ABCDEFGH".Contains(kj))
                {
                    xin.Image = 选图区域(@System.Environment.CurrentDirectory + "\\数字\\数字0.jpg", 图0坐标[++循环 - 8][0], 图0坐标[循环 - 8][1], 图0坐标[0][0], 图0坐标[0][1], xin.Width, xin.Height);
                    xin.Location = new Point((xin.Right * (循环 - 9)) + 5 * (循环 - 8), xin.Bottom + 15);
                }
            }
        }
        private void 微佛诞提示日历时间_Load(object sender, EventArgs e)
        {
            Size pin = System.Windows.Forms.SystemInformation.WorkingArea.Size;
            this.Location = new Point(pin.Width - this.Width - 45, pin.Height - this.Height);
            this.AllowDrop = true; //this.Opacity = .9;
            this.DoubleClick += new EventHandler(窗体双击);
            this.Resize += new EventHandler(窗体大小);
            this.FormClosed += new FormClosedEventHandler(关闭后);
            this.DragDrop += new DragEventHandler(窗体拖放);
            this.DragEnter += new DragEventHandler(拖入窗体);
            this.Paint += new PaintEventHandler(窗体绘图);
 
            if (判断文件存在(@System.Environment.CurrentDirectory + "\\" + "定时提醒表.XML")) 数据表加载(ref 定时提醒表);
            else 定时提醒表.Columns.Add("提醒列表", typeof(string));//若提醒已完成则从列表删除
 
            加载日期时间控件();
            月历加载(/*初始*/);
            定时.AutoReset = true; 定时.Enabled = true;
            定时.Elapsed += new System.Timers.ElapsedEventHandler(定时触发);
            托盘.Click += new EventHandler(点击托盘);
 
            控件说明.ToolTipIcon = ToolTipIcon.Info;
            控件说明.ToolTipTitle = "微佛诞提示日历时间";
 
            Microsoft.Win32.SystemEvents.SessionSwitch += new Microsoft.Win32.SessionSwitchEventHandler(用户登录);


        }
 
        private void 图片单击(object sender, EventArgs e)
        {
            string 控件名 = ((PictureBox)sender).Name, 鼠标键名 = ((MouseEventArgs)e).Button.ToString();
            if (控件名 == "8" && 鼠标键名 == "Right") 开机启动();
            if (控件名 == "6" && 鼠标键名 == "Left")//设置时间提醒
            {
                //var dd = this.Controls[this.Controls.IndexOfKey("1")].Tag;
            }
            //MessageBox.Show(((PictureBox)sender).Name + "\r\n" + ((MouseEventArgs)e).Button.ToString());
        }
        private void 关闭后(object sender, FormClosedEventArgs e)
        {
            托盘.Visible = false;
        }
        private void 点击托盘(object sender, EventArgs e)
    
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值