日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

C#创建隐藏文件

發布時間:2024/6/5 55 豆豆
生活随笔 收集整理的這篇文章主要介紹了 C#创建隐藏文件 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

private void button3_Click(object sender, EventArgs e)
{
File.SetAttributes(textBox1.Text, FileAttributes.Normal);//設置文件夾屬性為正常
Directory.SetCreationTime(textBox1.Text, dateTimePicker1.Value);//設置文件夾創建時間
Directory.SetLastWriteTime(textBox1.Text, dateTimePicker2.Value);//設置文件夾最近被修改時間
Directory.SetLastAccessTime(textBox1.Text, dateTimePicker3.Value);//設置文件夾最近被訪問時間
if (checkBox1.Checked == true)
File.SetAttributes(textBox1.Text, FileAttributes.ReadOnly);//設置成只讀文件夾
FileAttributes MyAttributes = File.GetAttributes(textBox1.Text);
if (this.checkBox2.Checked == true)
File.SetAttributes(textBox1.Text, MyAttributes | FileAttributes.System);//設置添加系統文件夾
MyAttributes = File.GetAttributes(textBox1.Text);
if (this.checkBox3.Checked == true)
File.SetAttributes(textBox1.Text, MyAttributes | FileAttributes.Hidden);//設置添加隱藏文件夾
MyAttributes = File.GetAttributes(textBox1.Text);
if (this.checkBox4.Checked == true)
File.SetAttributes(textBox1.Text, MyAttributes | FileAttributes.Archive);//設置添加歸檔文件夾
MyAttributes = File.GetAttributes(textBox1.Text);
MessageBox.Show("設置文件夾屬性操作成功!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
注:textBox1.Text是一個文件夾

轉載于:https://www.cnblogs.com/ddlzq/archive/2011/07/25/2116519.html

總結

以上是生活随笔為你收集整理的C#创建隐藏文件的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。