public int ToolboxSelectionChanged(IDataObject pSelected) { if (pSelected == null) { return(VSConstants.S_FALSE); } _selectedToolboxData = (OleDataObject)pSelected; ToolboxData data = (ToolboxData)_selectedToolboxData.GetData(typeof(ToolboxData)); editorControl.tbDropData.Text = data.Content; return(VSConstants.S_OK); }
public int ItemPicked(IDataObject pDO) { // Create a OleDataObject from the input interface. OleDataObject oleData = new OleDataObject(pDO); // Check if the picked item is the one we added to the toolbox. if (oleData.GetDataPresent(typeof(ToolboxData))) { System.Diagnostics.Trace.WriteLine("MyToolboxItemData selected from the toolbox"); ToolboxData myData = (ToolboxData)oleData.GetData(typeof(ToolboxData)); editorControl.tbDropData.Text = myData.Content; } return(VSConstants.S_OK); }
public int InterceptDataObject(IDataObject pIn, out IDataObject ppOut) { ToolboxData myData = new ToolboxData("NotDefined"); ppOut = null; if (_selectedToolboxData == null) { return(VSConstants.S_FALSE); } else { myData = (ToolboxData)_selectedToolboxData.GetData(typeof(ToolboxData)); } OleDataObject newtoolboxData = new OleDataObject(); newtoolboxData.SetText($"Dropped {myData?.Content}", System.Windows.Forms.TextDataFormat.Text); ppOut = newtoolboxData; return(VSConstants.S_OK); }