本帖最后由 许庭洲 于 2013-6-15 18:49 编辑
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace 身份验证图片显示
{
public partial calss Form1 : Form
{
public Form1()
{
InitialzeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string 身份证号 = textBox1.Text;
//检验是否是合法的身份证号,不考虑X
//13122619810522****
pictureBox1.Visible = false;//先将图片隐藏
string strYear = 身份证号.Substring(6,4);
int year = Convert.ToInt32(strYear);
if(DateTime.Now.Year - year > 18)
{
pictureBox1.Visible = true;//年龄大于18岁,条件成立,图片显示
}
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|