Shoutbox

C++ Questions (Drag and Drop) - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: C++ Questions (Drag and Drop) (/showthread.php?tid=51354)

C++ Questions (Drag and Drop) by leito on 10-04-2005 at 02:58 AM

Hey guys, I'm really sorry of asking another C++ question, but I'm a newbie and need some help from you! For homework, I have to make a Solitaire. I finished, but know I would like to implement Drag and Drop.

I have read a lot of examples in the Internet and Google it, but I only found VB and C# examples. I adapt two and got this C++ code which didn't work:

code:
    private: System::Void pictureBox1_MouseDown(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
this->pictureBox2->AllowDrop = true;
                                             this->pictureBox1->DoDragDrop(this->pictureBox1->Image, DragDropEffects::Copy);
       
             }
    private: System::Void pictureBox2_DragEnter(System::Object^  sender, System::Windows::Forms::DragEventArgs^  e) {
                 if (e->Data->GetDataPresent(DataFormats::Bitmap))
                     e->Effect = DragDropEffects::Copy;
                 else
                     e->Effect = DragDropEffects::None;
             }
    private: System::Void pictureBox2_DragDrop(System::Object^  sender, System::Windows::Forms::DragEventArgs^  e) {
                 this->pictureBox2->Image = (Image^)e->Data->GetData(DataFormats::Bitmap);
             }


pictureBox1 is the Source pictureBox and pictureBox2 is the Destination pictureBox.

Maybe you could point me out errros, or give me some places to search, and Thanks again.

edit: missing "= true" it works, but I should need better documentations to finish the drag and drop for the solitaire