0

私は21個のビデオファイルを持つwinformアプリケーションを持っており、それらのパスはこのようにapplicaton.startupPathとして設定されています...

vpath[0] = Application.StartupPath + @"\v00.m4v";
        vpath[1] = Application.StartupPath + @"\v01.m4v";
        vpath[2] = Application.StartupPath + @"\v02.m4v";
        vpath[3] = Application.StartupPath + @"\v03.m4v";
        vpath[4] = Application.StartupPath + @"\v04.m4v";
        vpath[5] = Application.StartupPath + @"\v05.m4v";
        vpath[6] = Application.StartupPath + @"\v06.m4v";
        vpath[7] = Application.StartupPath + @"\v07.m4v";
        vpath[8] = Application.StartupPath + @"\v08.m4v";
        vpath[9] = Application.StartupPath + @"\v09.m4v";
        vpath[10] = Application.StartupPath + @"\v10.m4v";
        vpath[11] = Application.StartupPath + @"\v11.m4v";
        vpath[12] = Application.StartupPath + @"\v12.m4v";
        vpath[13] = Application.StartupPath + @"\v13.m4v";
        vpath[14] = Application.StartupPath + @"\v14.m4v";
        vpath[15] = Application.StartupPath + @"\v15.m4v";
        vpath[16] = Application.StartupPath + @"\v16.m4v";
        vpath[17] = Application.StartupPath + @"\v17.m4v";
        vpath[18] = Application.StartupPath + @"\v18.m4v";
        vpath[19] = Application.StartupPath + @"\v19.m4v";
        vpath[20] = Application.StartupPath + @"\v20.m4v";

ユーザーがこれらのビデオを変更したい場合は、v00 から v20 に名前を付ける必要があります。ユーザーが異なる形式のビデオを追加した場合、どうすればパスを変更できますか?? 実行時に変更できますか?はいの場合、どのように??

4

2 に答える 2

0

コードに別の変数を追加できます

public string VideoPath;

で初期化します

VideoPath = Application.StartupPath;

必要に応じて変更するよりも

于 2012-09-27T05:55:52.707 に答える
0

StartupPathは通常の変数ではありません。実際、それはまったく変数ではなく、「書き込む」こともできません。これは取得専用のプロパティです。

実際には、メインの実行可能ファイルを必要なディレクトリにコピーし、そこから再実行することで、そのプロパティ結果の値を変更できますが、ポイントは何ですか?

PathDirectoryおよびFileクラスに移動して、ファイル システムの操作方法を学習します。

于 2012-09-27T07:08:51.073 に答える