2017-08-19 3 views

答えて

1

ちょうど私が独自のディレクトリではなく、プロジェクト/ソリューション・ディレクトリに、アプリケーションファイルの残りの部分から分離されたデータを格納しますプロジェクト

1

のルートディレクトリに.pdfファイルを配置します。 pdfファイルをこのディレクトリに置き、静的なクラス/文字列を使用してこのフォルダの(相対的な)場所を格納します。もう1つの良い方法は、jsonファイルにディレクトリの場所を設定することです。 WPF側ではListBoxをこのストアの場所に、directory.getfilesを使用してpdfのリストを取得してください。

0
I have eventually settled on using Resources as pdf storage. 
So the steps include: 
1. Open project's Properties. Select Resources. A blank white window will appear. 
2. Dragg the files (in this case the .pdf's) onto this window. 
3. A new folder in Project Explorer will appear called Resources, and all the added files will be in the folder. 
4. Select all files in the Resources folder and changed Build Action to Embedded Resource. 
5. To accesses the .pdf files, 

string pDF = Path.Combine(Path.GetTempPath(), "Name of the Pdf.pdf"); 
      File.WriteAllBytes(pDF, YouProjectName.Properties.Resources.Name of the Pdf); 
6. To open pdf 
Process.Start(pDF); 

I found it convenient to have the .pdfs be embedded into AppName.exe. 
関連する問題