我目前必须编写代码以允许我读取文件夹的所有文件并将其写入控制台.下面,我还有了使用浏览器从目录中选择单个文件的代码.我想知道如何使用浏览按钮选择文件夹.
用于检查所有文件的代码
foreach(var path in Directory.GetFiles(@"C:\Name\Folder\"))
{
Console.WriteLine(path); // full path
Console.WriteLine(System.IO.Path.GetFileName(path)); // file name
}
Run Code Online (Sandbox Code Playgroud)
代码打开对话框
OpenFileDialog fileSelectPopUp = new OpenFileDialog();
fileSelectPopUp.Title = "";
fileSelectPopUp.InitialDirectory = @"c:\";
fileSelectPopUp.Filter = "All EXCEL FILES (*.xlsx*)|*.xlsx*|All files (*.*)|*.*";
fileSelectPopUp.FilterIndex = 2;
fileSelectPopUp.RestoreDirectory = true;
if (fileSelectPopUp.ShowDialog() == DialogResult.OK)
{
textBox1.Text = fileSelectPopUp.FileName;
}
Run Code Online (Sandbox Code Playgroud) 下面是我创建的用于绘制按钮的CSS代码.当我在Chrome中查看此按钮时,该按钮看起来应该是圆形的,但在Firefox和IE上,它是方形的.为什么会这样呢?
<!-- language: lang-css -->
.button {
width:90px;
float:right;
background:#FEDA71;
background:-moz-linear-gradient(top,#FEDA71 0%,#FEBB49 100%);
background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#FEDA71),color-stop(100%,#FEBB49));
background:-webkit-linear-gradient(top,#FEDA71 0%,#FEBB49 100%);
background:-o-linear-gradient(top,#FEDA71 0%,#FEBB49 100%);
background:-ms-linear-gradient(top,#FEDA71 0%,#FEBB49 100%);
background:linear-gradient(top,#FEDA71 0%,#FEBB49 100%);
padding:8px 18px;
color:#623F1D;
font-family:'Helvetica Neue',sans-serif;
font-size:16px;
-moz-border-radius:48px;
-webkit-border-radius:48px;
border:1px solid #623F1D
}
Run Code Online (Sandbox Code Playgroud)
下面的代码使Firefox开始工作,但IE仍然无法工作
Code after change and still doensnt work
background:#FEDA71;
background:-moz-linear-gradient(top,#FEDA71 0%,#FEBB49 100%);
background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#FEDA71),color-stop(100%,#FEBB49));
background:-webkit-linear-gradient(top,#FEDA71 0%,#FEBB49 100%);
background:-o-linear-gradient(top,#FEDA71 0%,#FEBB49 100%);
background:-ms-linear-gradient(top,#FEDA71 0%,#FEBB49 100%);
background:linear-gradient(top,#FEDA71 0%,#FEBB49 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FEDA71',endColorstr='#FEBB49',GradientType=0);
padding:8px 18px;
color:#623F1D;
font-family:'Helvetica Neue',sans-serif;
font-size:16px;
border-radius:48px;
-moz-border-radius:48px;
-webkit-border-radius:48px;
border:1px solid #623F1D
Run Code Online (Sandbox Code Playgroud) 我在我的页面上有一些喜欢使用的图像<a href=""><img><\a>
,当它们在chrome和firefox中显示它们工作正常时,但在IE上他们在图像周围有一个紫色的环,任何想法为什么会是这种情况