WinForm显示图片示例
在 WinForm 中显示图片的代码示例如下:
private void button1_Click(object sender, EventArgs e) {
string s = textBox1.Text.ToString().Substring(6, 4);
int i = DateTime.Now.Year - int.Parse(s);
if (i >= 18)
pictureBox1.Visible = true;
else
pictureBox1.Visible = false;
}
此代码实现了根据用户输入的年份判断是否显示 pictureBox 控件。
469KB
文件大小:
评论区