lee1126 發問時間: 社會與文化語言 · 1 0 年前


(35%) Create a GUI application that displays images in a PictureBox. Allow the user to enter the path of the image in a TextBox and click a Button to display the image. If the user enters an invalid file path, a FileNotFoundException will occur. Use exception handling so that a default image will be displayed if an invalid path is entered. Whether a valid path is entered or not, clear the TextBox where the user enters input. Three images have been provided in the examples folder for this chapter in the Ex12_10 directory. Use the image named image0.bmp as the default image. You can use the other two images to test entering a valid path. [Note: You will need to specify that you are using the System.IO namespace for this exercise. Use method Focus inherited from class Control to set the focus. To set a PictureBox to display a particular image, assign Image.FromFile( path ) to its Image property, where path is a string variable that specifies the image’s filename relative to the current directory.]



1 個解答

  • 1 0 年前

    (35%) 創造一種顧應用那複顯圖像在圖片資料夾裡。允許用戶送進圖像的道路在資料文件和點擊按鈕顯示圖像。如果用戶進入一個無效文件道路, FileNotFoundException 將發生。使用異常處理以便缺省圖像將被顯示如果一個無效道路被輸入。不管一個合法的道路被輸入或不是, 清楚資料文件用戶進入輸入的地方。三個圖像被提供了在例子文件夾為這個章節在Ex12_10 目錄。使用圖像被命名image0.bmp 作為缺省圖像。您能使用其它二個圖像測試進入一個合法的道路。[ 筆記: 您將需要指定, 您使用System.IO namespace 為這鍛煉。使用方法焦點被繼承從類控制設置焦點。設置PictureBox 顯示一個特殊圖像, 分配Image.FromFile(道路) 到它的圖像物產, 道路是串可變物指定圖像的文件名相對當前目錄。

    參考資料: 這是我自己翻譯的唷~