[問題] pictureBox的DragEnter事件問題
我目前想讓pictureBox可以接受用滑鼠拖曳的方式
顯示圖片(pictureBox1又放在panel內),所以我有
對DragEnter DragDrop這兩個事件處理,但是執行
後卻無法拖曳檔案到pictureBox1內 ??? 以下是
DragEnter與DragDrop兩事件的code:
private: System::Void Form1_Load(...略...)
{
pictureBox1->AllowDrop=true;
}
private: System::Void pictureBox1_DragEnter(..略...)
{
//判斷拖進來的是否是圖檔
if ( e->Data->GetDataPresent(DataFormats::Bitmap) )
e->Effect = DragDropEffects::Copy;
else
e->Effect = DragDropEffects::None;
}
private: System::Void pictureBox1_DragDrop(..略...)
{
//取得檔案路徑
String^ name=Convert::ToString(e->Data->GetData(DataFormats::Bitmap));
//用pictureBox顯示
pictureBox1->Image =gcnew Bitmap(name);
}
可以執行,卻無法拖曳檔案到pictureBox1內,也就是當用左鍵
拖曳到pictureBox1上面時,滑鼠的圖案是呈現 "一個圓圈中間一條斜線"
的圖形.....想請問有經驗的人這樣寫是否哪裡有問題??
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.204.4.165
※ 編輯: bbbbbbjeff 來自: 123.204.4.165 (11/21 01:15)
※ 編輯: bbbbbbjeff 來自: 123.204.4.165 (11/21 03:44)
※ 編輯: bbbbbbjeff 來自: 123.204.4.165 (11/21 03:45)