【原创源码】更改系统时间
本帖最后由 奋斗丶小Z 于 2016-4-5 20:09 编辑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;
namespace 更改系统时间
{
public partial class ChaTime : Form
{
public ChaTime()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
SystemTime MySystemTime = new SystemTime();
SetSystemDateTime.GetLocalTime(MySystemTime);
MySystemTime.vHour = (ushort)Convert.ToInt16(txbH.Text);
MySystemTime.vMinute = (ushort)Convert.ToInt16(txbM.Text);
MySystemTime.vSecond = (ushort)Convert.ToInt16(txbS.Text);
SetSystemDateTime.SetLocalTime(MySystemTime);
}
catch { }
}
private void timer1_Tick(object sender, EventArgs e)
{
label4.Text = "本机时间:" + Convert.ToString(DateTime.Now).Substring(Convert.ToString(DateTime.Now).Length - 8, 8);
}
private void ChaTime_Load(object sender, EventArgs e)
{
label4.Text = "本机时间:" + Convert.ToString(DateTime.Now).Substring(Convert.ToString(DateTime.Now).Length - 8, 8);
}
private void txbH_KeyPress(object sender, KeyPressEventArgs e)
{
try
{
int kc = (int)e.KeyChar;
if ((kc < 48 || kc > 57) && kc != 8)
e.Handled = true;
}
catch (Exception)
{
}
}
private void txbM_KeyPress(object sender, KeyPressEventArgs e)
{
try
{
int kc = (int)e.KeyChar;
if ((kc < 48 || kc > 57) && kc != 8)
e.Handled = true;
}
catch (Exception)
{
}
}
private void txbS_KeyPress(object sender, KeyPressEventArgs e)
{
try
{
int kc = (int)e.KeyChar;
if ((kc < 48 || kc > 57) && kc != 8)
e.Handled = true;
}
catch (Exception)
{
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace 更改系统时间
{
publicclass SystemTime
{
public ushort vYear;
public ushort vMonth;
public ushort vDayOfWeek;
public ushort vDay;
public ushort vHour;
public ushort vMinute;
public ushort vSecond;
}
}
c# 表示还在小白阶段 软件呢??? 小白一个~~~~表示看不懂!!! 小白,只要看结果
页:
[1]