?? Why is PictureBox.AllowDrop Discouraged ??

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyone know why the PictureBox.AllowDrop property is discouraged? The
documentation indicates, "This property supports the .NET Framework
infrastructure and is not intended to be used directly from your code."

WHY??

I have several PictureBoxes that I would like to use as sources and targets
for drag & drop. Are there viable alternatives?

I know I *could* still use the PictureBox.AllowDrop property but I am
hesitant now after reading the documentation.

Thanks
 
How would you expect the PictureBox to react as a drop target?

The window being dropped on must look to see if it accepts the thing
being dropped, signal the acceptance or rejection to the user and then
accept / decode / display whatever it was that got dropped.

It would be easier to create a control based object that handled your
various drop formats than try to coerce PictureBox, the worlds most
accursed control, into doing something_else_ it was never supposed to do.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Bob Powell said:
How would you expect the PictureBox to react as a drop target?

I'm not sure what you're getting at here. The item I'm dropping is in fact
an Image from another PictueBox. Maybe you had the impression I was dropping
text or some custom data. Basically, I want to allow the user to move
various images between PictureBixes.

The window being dropped on must look to see if it accepts the thing being
dropped, signal the acceptance or rejection to the user and then accept /
decode / display whatever it was that got dropped.

Yes, of course. But what you said here applies to *any* drop target.

As I said, dropping images between PictureBoxes should be no problem, as far
as I can see. In fact, even dropping text should be no problem -- if a user
were to drop text onto a PictureBox the text could easily be rendered as an
image by the PictureBox's DragDrop handler and then displayed in the
PictureBox -- nothing strange about that AFAIK.

So, again, I wonder why Microsoft has decided we should not be able to use
PictureBox as a drop target.
 
Back
Top