Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / Design Time / February 2005

Tip: Looking for answers? Try searching our database.

Deserializing a dropped ToolBoxItem in a ParentControlDesigner.OnDragDrop function

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Robin Sanner - 25 Feb 2005 20:48 GMT
Currently when a OnDragDrop event fires in my control designer I use
ISelectionService to get the component that was dropped.  I know there has
to be a way to get the component out of the DragEventArgs.Data.GetData()
method but I have been unable to figure out how.  When you drop a control
from the ToolBox DragEventArgs.Data.GetDatapresent(".NET Toolbox Item")
returns true and DragEventArgs.Data.GetData(".NET Toolbox Item") returns a
MemoryStream.  IToolBoxService.IsToolBoxItem reports False.

I also can't figure out how to get the dropped object out of the
DragEventArgs when it's not a ToolBoxItem.

What is the right way to do this?  I am currently using ISelectionService
and it works but there MUST be a way to get the object out of DragEventArgs.
What am I missing?

Thank you
Robin Sanner
robin.sanner@verizon.net
Simon Lawrence - 26 Feb 2005 10:48 GMT
On 25/02/2005 8:49 PM, in article uXb1Gu3GFHA.2736@TK2MSFTNGP09.phx.gbl,

Hi Robin,

> Currently when a OnDragDrop event fires in my control designer I use
> ISelectionService to get the component that was dropped.  I know there has
[quoted text clipped - 3 lines]
> returns true and DragEventArgs.Data.GetData(".NET Toolbox Item") returns a
> MemoryStream.  IToolBoxService.IsToolBoxItem reports False.

The object that is being dropped is the toolbox item rather than the new
component (see IToolboxService.DeserializeToolboxItem and
IToolboxItem.CreateComponents). The MSDN Shape Designer sample illustrates
what happens ( http://windowsforms.net/articles/shapedesigner.aspx - see the
discussion around the OnDragDrop handler in the article).

I'm not sure what it is you're trying to do but maybe the events on
IComponentChangeService (ComponentAdded, ComponentAdding etc.) might be an
easier way of achieving it.

Cheers,

Simon

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.