分享

V9.6 DateTimePicker 日期控件(1)

 时间剧毒 2019-04-29

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

namespace V9.__DateTimePicker_控件_1_

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

        private void Form1_Load(object sender, EventArgs e)

        {

            //datetimepicker 

            //显示时间

            //默认显示日期,显示时间必须将 ShowUpDown属性设置为 True, 将Format属性设置为 True ;

            //自定义日期 先将 Format 属性设置为Custom,然后将 CustomFormat 属性设置为一个 格式字符串 

            //Year 返回年

            //Month 返回月

            //Date 返回日期部分

            //Day 返回日

            //DayOfWeek 返回星期

            //Hour 返回小时

            //Mintue 返回分钟

            //Second 返回秒

            //TimeOfDay 返回当前时间

            //Millsecond 返回毫秒

            //天干  0甲、 1乙 、2丙 、3丁 、4戊 、5已、 6庚、 7辛、 8壬、 9葵

            //地支  0子、1丑、2寅、3卯、4辰、5巳、6午、7未、8申、9酉、10戌、11亥

            //天干=(年份-4)%10   地支 (年份-4)%12

        }

        private void dateTimePicker3_ValueChanged(object sender, EventArgs e)

        {

            string tg = "甲乙丙丁戊已庚辛壬葵";

            string dz = "子丑寅卯辰巳午未申酉戌亥";

            string sx = "鼠牛虎兔龙蛇马羊猴鸡狗猪";

            int year = dateTimePicker3.Value.Year;

            label1.Text = "您选择的年为农历:" + tg[(year - 4) % 10] + dz[(year - 4) % 12] + "年,是" + sx[(year - 4) % 12];

        }

    }

}

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多