//申明变量path
string path = openFileDialog1.FileName;
//如果checkBox1复选框被选中就将文件设置为只读属性.
if(checkBox1.Checked == true)
{
File.SetAttributes(path, FileAttributes.ReadOnly);
}
else
{
}
//如果checkBox2被选中.就将文件设置为隐藏属性.
if(checkBox2.Checked == true)
{
File.SetAttributes(path, FileAttributes.Hidden);
}
else
{
}如果我把checkBox1和checkBox2同时选中想将文件同时拥有两种属性.我上面的结果怎么弄都只有一个属性.原因我是知道的但不知道怎么写才能把只读和隐藏属性同时给这个文件~`
要怎么改阿~~~刚学C#不会.....55555
string path = openFileDialog1.FileName;
//如果checkBox1复选框被选中就将文件设置为只读属性.
if(checkBox1.Checked == true)
{
File.SetAttributes(path, FileAttributes.ReadOnly);
}
else
{
}
//如果checkBox2被选中.就将文件设置为隐藏属性.
if(checkBox2.Checked == true)
{
File.SetAttributes(path, FileAttributes.Hidden);
}
else
{
}如果我把checkBox1和checkBox2同时选中想将文件同时拥有两种属性.我上面的结果怎么弄都只有一个属性.原因我是知道的但不知道怎么写才能把只读和隐藏属性同时给这个文件~`
要怎么改阿~~~刚学C#不会.....55555
正解
button为修改功...如果同时选中了三个按钮~~就必须给文件三种权限了....(选中两个就给两个相应的权限了)
button的事件怎么写最好~~~