Re: [問題] BCB隨機不重複出現圖
原文的迴圈太複雜,我剛睡醒沒仔細看,
照您的標題的需求,先拉一個Image元件,再拉一個Button,
程式碼寫在Button理,如下:
TStringList *Image_Path_List=new TStringList();
//使用StringList儲存圖片的路徑
Image_Path_List->LoadFromFile("C:\\imagepath.txt");
//這裡我使用讀取外部檔案來取得圖片路徑,將圖片路徑以每行一筆儲存在純文件裡
//或者你也可以使用Image_Path_List->Add("c:\\image1.bmp")
// Image_Path_List->Add("c:\\image2.bmp")..類推
//當然你也可以用普通的陣列儲存路徑
randomize();
Image1->Picture->LoadFromFile(
Image_Path_List->Strings[rand()%Image_Path_List->Count]);
delete Image_Path_List;
最後,歡迎你加入BCB ^_^,如果這樣不是你的需求,推文說吧~上完課再看
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.39.173.34
→
11/24 20:55, , 1F
11/24 20:55, 1F
→
11/24 20:55, , 2F
11/24 20:55, 2F
推
11/24 22:00, , 3F
11/24 22:00, 3F
→
11/24 22:01, , 4F
11/24 22:01, 4F
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):
問題
0
3