日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > C# >内容正文

C#

C#创建隐藏文件

發布時間:2024/6/5 C# 45 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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#创建隐藏文件的全部內容,希望文章能夠幫你解決所遇到的問題。

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