Skip to content

Commit 1e8fdda

Browse files
committed
修复目录选择无效的BUG
1 parent 103d323 commit 1e8fdda

File tree

3 files changed

+13
-26
lines changed

3 files changed

+13
-26
lines changed

PDFQFZ/Form1.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PDFQFZ/Form1.cs

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,29 +1285,16 @@ private void SelectPath_Click(object sender, EventArgs e)
12851285
{
12861286
if (Environment.OSVersion.Version.Major >= 6) //操作系统win7及以上才能使用此效果
12871287
{
1288-
var fsd = new FolderSelectDialog();
1289-
//FolderSelectDialog fsd = new FolderSelectDialog();
1288+
FolderSelectDialog fsd = new FolderSelectDialog();
12901289
fsd.Title = "请选择pdf所在的文件夹";
1291-
if (string.IsNullOrWhiteSpace(pathText.Text.Trim()))
1290+
fsd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
1291+
if (fsd.ShowDialog(this.Handle))
12921292
{
1293-
string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
1294-
fsd.InitialDirectory = desktopPath; // @"c:\";
1295-
}
1296-
else
1297-
{
1298-
//fsd.InitialDirectory = @"c:\";
1299-
//fsd.InitialDirectory = appDirecroty;
1300-
fsd.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory; //当前程序的基目录不会变
1301-
}
1302-
if (fsd.ShowDialog(this.Handle)) //IntPtr.Zero和this.Handle区别
1303-
{
1304-
//this.pathText.ForeColor = Color.Black;
1305-
//this.pathText.Text = fsd.FileName;
1306-
pathText.Text = fsd.InitialDirectory;
1307-
pathDir = fsd.InitialDirectory;
1293+
pathText.Text = fsd.FileName;
1294+
pathDir = fsd.FileName;
13081295
if (textBCpath.Text == "")
13091296
{
1310-
textBCpath.Text = fsd.InitialDirectory + "\\QFZ";
1297+
textBCpath.Text = fsd.FileName + "\\QFZ";
13111298
}
13121299
dt.Rows.Clear();
13131300
dt.Rows.Add(new object[] { "", "" });
@@ -1386,21 +1373,20 @@ private void OutPath_Click(object sender, EventArgs e)
13861373
{
13871374
if (Environment.OSVersion.Version.Major >= 6) //操作系统win7及以上才能使用此效果
13881375
{
1389-
var fsd = new FolderSelectDialog();
1390-
//FolderSelectDialog fsd = new FolderSelectDialog();
1376+
FolderSelectDialog fsd = new FolderSelectDialog();
13911377
fsd.Title = "请选择保存的文件夹";
13921378
if (string.IsNullOrWhiteSpace(pathText.Text.Trim()))
13931379
{
13941380
string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
1395-
fsd.InitialDirectory = desktopPath; // @"c:\";
1381+
fsd.InitialDirectory = desktopPath;
13961382
}
13971383
else
13981384
{
1399-
fsd.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory; //当前程序的基目录不会变
1385+
fsd.InitialDirectory = pathText.Text;
14001386
}
1401-
if (fsd.ShowDialog(this.Handle)) //IntPtr.Zero和this.Handle区别
1387+
if (fsd.ShowDialog(this.Handle))
14021388
{
1403-
textBCpath.Text = fsd.InitialDirectory;
1389+
textBCpath.Text = fsd.FileName;
14041390
}
14051391
}
14061392
else

PDFQFZ/PDFQFZ.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
<SpecificVersion>False</SpecificVersion>
7979
<HintPath>D:\Downloads\428a8-main\O2S.Components.PDFRender4NET.dll</HintPath>
8080
</Reference>
81+
<Reference Include="System" />
8182
<Reference Include="System.Data" />
8283
<Reference Include="System.Drawing" />
8384
<Reference Include="System.Windows.Forms" />

0 commit comments

Comments
 (0)