📄 form1.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
namespace WindowsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
string[] a = new string[50]{ "(GMT -12:00) Eniwetok, Kwajalein ",
"(GMT -11:00) Midway Island, Samoa ",
"(GMT -10:00) Hawaii ",
"(GMT -09:00) Alaska ",
"(GMT -08:00) Pacific Time (US and Canada); Tijuana" ,
"(GMT -07:00) Arizona" ,
"(GMT -07:00) Mountain Time (US and Canada)" ,
"(GMT -06:00) Central Time (US and Canada)",
"(GMT -06:00) Mexico City, Tegucigalpa" ,
"(GMT -06:00) Saskatchewan" ,
"(GMT -05:00) Bogota, Lima" ,
"(GMT -05:00) Eastern Time (US and Canada)" ,
"(GMT -05:00) Indiana (East)",
"(GMT -04:00) Atlantic Time (Canada)",
"(GMT -04:00) Caracas, La Paz" ,
"(GMT -03:30) Newfoundland",
"(GMT -03:00) Brasilia",
" (GMT -03:00) Buenos Aires, Georgetown",
"(GMT -02:00) Mid-Atlantic ",
"(GMT -01:00) Azores, Cape Verde Is.",
"(GMT +00:00) Greenwich Mean Time; Dublin, Edinburgh, London, Lisbon ",
" (GMT +00:00) Monrovia, Casablanca",
"(GMT +01:00) Berlin, Stockhold, Rome, Bern, Brussels, Vienna",
" (GMT +01:00) Paris, Madrid, Amsterdam" ,
"(GMT +01:00) Prage, Warsaw, Budapest" ,
"(GMT +02:00) Athens, Helsinki, Istanbul ",
"(GMT +02:00) Cairo",
"(GMT +02:00) Eastern Europe",
"(GMT +02:00) Harare, Pretoria" ,
"(GMT +02:00) Israel ",
" (GMT +03:00) Baghdad, Kuwait, Nairobi, Riyadh",
"(GMT +03:00) Moscow, St. Petersburgh, Kazan, Volgograd",
"(GMT +03:00) Tehran ",
"(GMT +04:00) Abu Dhabi, Muscat, Tbilisi" ,
"(GMT +04:30) Kabul" ,
"(GMT +05:00) Islamabad, Karachi, Ekaterinburg, Tashkent",
"(GMT +05:30) Bombay, Calcutta, Madras, New Delhi, Colombo",
"(GMT +06:00) Almaty, Dhaka ",
"(GMT +07:00) Bangkok, Jakarta, Hanoi" ,
"(GMT +08:00) Beijing, Chongqing, Urumqi" ,
" (GMT +08:00) Hong Kong, Perth, Singapore, Taipei ",
" (GMT +09:00) Tokyo, Osaka, Sapporo, Seoul, Yakutsk",
"(GMT +09:30) Adelaide" ,
"(GMT +09:30) Darwin",
"(GMT +10:00) Brisbane, Melbourne, Sydney" ,
"(GMT +10:00) Guam, Port Moresby, Vladivostok" ,
"(GMT +10:00) Hobart" ,
"(GMT +11:00) Magadan, Solomon Is., New Caledonia",
"(GMT +12:00) Fiji, Kamchatka, Marshall Is." ,
"(GMT +12:00) Wellington, Auckland", };
foreach (string str1 in a)
comboBox1.Items.Add(str1);
this.comboBox1.SelectedIndex = 0;
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
//int[] a = new int[5] { 0,3,6,4,1 };
if (comboBox1.SelectedIndex == 0 || comboBox1.SelectedIndex == 1 || comboBox1.SelectedIndex == 2 || comboBox1.SelectedIndex == 5 || comboBox1.SelectedIndex == 8 || comboBox1.SelectedIndex == 9 || comboBox1.SelectedIndex == 10 || comboBox1.SelectedIndex == 12 || comboBox1.SelectedIndex == 14 || comboBox1.SelectedIndex == 17 || comboBox1.SelectedIndex == 21 || comboBox1.SelectedIndex == 28 || comboBox1.SelectedIndex == 30 || comboBox1.SelectedIndex == 33||comboBox1.SelectedIndex == 34|| comboBox1.SelectedIndex == 35 || comboBox1.SelectedIndex == 36|| comboBox1.SelectedIndex == 37 || comboBox1.SelectedIndex == 38 || comboBox1.SelectedIndex == 40 || comboBox1.SelectedIndex == 41 || comboBox1.SelectedIndex == 43 || comboBox1.SelectedIndex == 45 || comboBox1.SelectedIndex == 47 || comboBox1.SelectedIndex == 48 )
{
checkBox1.Enabled = false ;
}
else {
checkBox1.Enabled = true;
}
}
private void button3_Click(object sender, EventArgs e)
{
int [] a = new int [50] {-720 ,-660 ,-600,540, -480 ,-420 ,-420, -360, -360 ,-360 ,-300, -300, -300 ,-240, -240 ,-210, -180, -180,-120, -060, +000, +000 ,+060, +060, +060, +120, +120, +120, +120,+120, +180 ,+180, +180, +240, +270,+300,
+330 ,+360, +420 ,+480 ,+480,+540, +570 ,+570 ,+600, +600 ,+600, +660 ,+720, +720};
string m = "False";
string n = "True";
string[] s = new string[50]{m,m,m,n,n,m,n,n,m,m,m,n,m,n,m,n,n,m,n,n,n,m,n,n,n,n,n,n,m,n, m,n,n,m,m,m,m,m,m,n,m,m,n,m,n,m,n,m,m,n};
string ss=comboBox1.Text;
string message = "Time set to ...\n\n" + "======================\n" + "TimeZone=" + ss + "\n" + "Offset from GMT=" +a[comboBox1.SelectedIndex]+ "minutes\n" + "Auto daylight="+s[comboBox1.SelectedIndex]+"\n"+"===========================";
string caption = " Exercise 5";
DialogResult Result;
//MessageBox.Show (message,caption,MessageBoxButtons.OK,MessageBoxIcon.None,MessageBoxDefaultButton.Button1);
Result = MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
if (Result == DialogResult.Yes)
Application.Exit();
}
private void button1_Click(object sender, EventArgs e)
{
int[] a = new int[50] {-720 ,-660 ,-600,540, -480 ,-420 ,-420, -360, -360 ,-360 ,-300, -300, -300 ,-240, -240 ,-210, -180, -180,-120, -060, +000, +000 ,+060, +060, +060, +120, +120, +120, +120,+120, +180 ,+180, +180, +240, +270,+300,
+330 ,+360, +420 ,+480 ,+480,+540, +570 ,+570 ,+600, +600 ,+600, +660 ,+720, +720};
string m = "False";
string n = "True";
string[] s = new string[50] { m, m, m, n, n, m, n, n, m, m, m, n, m, n, m, n, n, m, n, n, n, m, n, n, n, n, n, n, m, n, m, n, n, m, m, m, m, m, m, n, m, m, n, m, n, m, n, m, m, n };
string ss = comboBox1.Text;
string message = "Time set to ...\n\n" + "======================\n" + "TimeZone=" + ss + "\n" + "Offset from GMT=" + a[comboBox1.SelectedIndex] + "minutes\n" + "Auto daylight=" + s[comboBox1.SelectedIndex] + "\n" + "===========================";
string caption = " Exercise 5";
DialogResult Result;
Result = MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
if (Result == DialogResult.OK)
Application.Exit();
}
private void button2_Click(object sender, EventArgs e)
{
int[] a = new int[50] {-720 ,-660 ,-600,540, -480 ,-420 ,-420, -360, -360 ,-360 ,-300, -300, -300 ,-240, -240 ,-210, -180, -180,-120, -060, +000, +000 ,+060, +060, +060, +120, +120, +120, +120,+120, +180 ,+180, +180, +240, +270,+300,
+330 ,+360, +420 ,+480 ,+480,+540, +570 ,+570 ,+600, +600 ,+600, +660 ,+720, +720};
string m = "False";
string n = "True";
string[] s = new string[50] { m,m,m,n,n,m,n,n,m,m,m,n,m,n,m,n,n,m,n,n,n,m,n,n,n,n,n,n,m,n, m,n,n,m,m,m,m,m,m,n,m,m,n,m,n,m,n,m,m,n };
string ss = comboBox1.Text;
string message = "Time set to ...\n\n" + "======================\n" + "TimeZone=" + ss + "\n" + "Offset from GMT=" + a[comboBox1.SelectedIndex] + "minutes\n" + "Auto daylight=" + s[comboBox1.SelectedIndex] + "\n" + "===========================";
string caption = " Exercise 5";
DialogResult Result;
Result = MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
if (Result == DialogResult.OK)
Application.Exit();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -