using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace DateTimePicker
{
/// <summary>
/// Form1 の概要の説明です。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.DateTimePicker dateTimePicker1;
private System.Windows.Forms.DateTimePicker dateTimePicker2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.DateTimePicker dateTimePicker3;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.DateTimePicker dateTimePicker4;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.DateTimePicker dateTimePicker5;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.DateTimePicker dateTimePicker7;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.DateTimePicker dateTimePicker6;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox1;
/// <summary>
/// 必要なデザイナ変数です。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Windows フォーム デザイナ サポートに必要です。
//
InitializeComponent();
//
// TODO: InitializeComponent 呼び出しの後に、コンストラクタ コードを追加してください。
//
}
/// <summary>
/// 使用されているリソースに後処理を実行します。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows フォーム デザイナで生成されたコード
/// <summary>
/// デザイナ サポートに必要なメソッドです。このメソッドの内容を
/// コード エディタで変更しないでください。
/// </summary>
private void InitializeComponent()
{
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.dateTimePicker2 = new System.Windows.Forms.DateTimePicker();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.dateTimePicker3 = new System.Windows.Forms.DateTimePicker();
this.label3 = new System.Windows.Forms.Label();
this.dateTimePicker4 = new System.Windows.Forms.DateTimePicker();
this.label4 = new System.Windows.Forms.Label();
this.dateTimePicker5 = new System.Windows.Forms.DateTimePicker();
this.label5 = new System.Windows.Forms.Label();
this.dateTimePicker7 = new System.Windows.Forms.DateTimePicker();
this.label6 = new System.Windows.Forms.Label();
this.dateTimePicker6 = new System.Windows.Forms.DateTimePicker();
this.button1 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// dateTimePicker1
//
this.dateTimePicker1.Location = new System.Drawing.Point(112, 24);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.TabIndex = 0;
//
// dateTimePicker2
//
this.dateTimePicker2.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dateTimePicker2.Location = new System.Drawing.Point(112, 152);
this.dateTimePicker2.Name = "dateTimePicker2";
this.dateTimePicker2.ShowUpDown = true;
this.dateTimePicker2.TabIndex = 1;
//
// label1
//
this.label1.Location = new System.Drawing.Point(16, 24);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(72, 16);
this.label1.TabIndex = 2;
this.label1.Text = "Long";
//
// label2
//
this.label2.Location = new System.Drawing.Point(16, 152);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 16);
this.label2.TabIndex = 3;
this.label2.Text = "SowUpDown";
//
// dateTimePicker3
//
this.dateTimePicker3.Format = System.Windows.Forms.DateTimePickerFormat.Short;
this.dateTimePicker3.Location = new System.Drawing.Point(112, 56);
this.dateTimePicker3.Name = "dateTimePicker3";
this.dateTimePicker3.TabIndex = 4;
//
// label3
//
this.label3.Location = new System.Drawing.Point(16, 56);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(72, 16);
this.label3.TabIndex = 5;
this.label3.Text = "Short";
//
// dateTimePicker4
//
this.dateTimePicker4.Format = System.Windows.Forms.DateTimePickerFormat.Time;
this.dateTimePicker4.Location = new System.Drawing.Point(112, 88);
this.dateTimePicker4.Name = "dateTimePicker4";
this.dateTimePicker4.TabIndex = 6;
//
// label4
//
this.label4.Location = new System.Drawing.Point(16, 88);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(72, 16);
this.label4.TabIndex = 7;
this.label4.Text = "Time";
//
// dateTimePicker5
//
this.dateTimePicker5.CustomFormat = "MM-MMMM, ddd-dddd";
this.dateTimePicker5.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dateTimePicker5.Location = new System.Drawing.Point(112, 120);
this.dateTimePicker5.Name = "dateTimePicker5";
this.dateTimePicker5.TabIndex = 8;
//
// label5
//
this.label5.Location = new System.Drawing.Point(16, 120);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(72, 16);
this.label5.TabIndex = 9;
this.label5.Text = "Custom";
//
// dateTimePicker7
//
this.dateTimePicker7.Location = new System.Drawing.Point(112, 184);
this.dateTimePicker7.Name = "dateTimePicker7";
this.dateTimePicker7.ShowCheckBox = true;
this.dateTimePicker7.TabIndex = 11;
//
// label6
//
this.label6.Location = new System.Drawing.Point(16, 184);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(96, 16);
this.label6.TabIndex = 12;
this.label6.Text = "SowCheckBox";
//
// dateTimePicker6
//
this.dateTimePicker6.Format = System.Windows.Forms.DateTimePickerFormat.Short;
this.dateTimePicker6.Location = new System.Drawing.Point(64, 224);
this.dateTimePicker6.Name = "dateTimePicker6";
this.dateTimePicker6.TabIndex = 13;
//
// button1
//
this.button1.Location = new System.Drawing.Point(88, 256);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(144, 23);
this.button1.TabIndex = 14;
this.button1.Text = "Short To Long ↓";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(64, 288);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(200, 19);
this.textBox1.TabIndex = 15;
this.textBox1.Text = "";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 12);
this.ClientSize = new System.Drawing.Size(328, 318);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button1);
this.Controls.Add(this.dateTimePicker6);
this.Controls.Add(this.label6);
this.Controls.Add(this.dateTimePicker7);
this.Controls.Add(this.label5);
this.Controls.Add(this.dateTimePicker5);
this.Controls.Add(this.label4);
this.Controls.Add(this.dateTimePicker4);
this.Controls.Add(this.label3);
this.Controls.Add(this.dateTimePicker3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.dateTimePicker2);
this.Controls.Add(this.dateTimePicker1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// アプリケーションのメイン エントリ ポイントです。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
System.DateTime selectedDateTime = this.dateTimePicker6.Value;
this.textBox1.Text = selectedDateTime.ToLongDateString();
}
}
}
|