/// <summary> /// Sends notification that an item in the Toolbox is selected through a click, or by pressing ENTER. /// </summary> /// <param name="pDO">Data object that is selected.</param> /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns> int IVsToolboxUser.ItemPicked(IOleDataObject 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(ToolboxItemData))) { Debug.WriteLine("MyToolboxItemData selected from the toolbox"); ToolboxItemData myData = (ToolboxItemData)oleData.GetData(typeof(ToolboxItemData)); editorControl.Text += myData.Content; } return VSConstants.S_OK; }
/// <summary> /// Determines whether the Toolbox user supports the referenced data object. /// </summary> /// <param name="pDO">Data object to be supported.</param> /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns> int IVsToolboxUser.IsSupported(IOleDataObject pDO) { // Create a OleDataObject from the input interface. OleDataObject oleData = new OleDataObject(pDO); // Check if the data object is of type MyToolboxData. if (oleData.GetDataPresent(typeof(ToolboxItemData))) return VSConstants.S_OK; // In all the other cases return S_FALSE return VSConstants.S_FALSE; }
public int ItemPicked(Microsoft.VisualStudio.OLE.Interop.IDataObject pDO) { // Create a OleDataObject from the input interface. OleDataObject oleData = new OleDataObject(pDO); // Check if the picked item is the one we can paste. if (oleData.GetDataPresent(DataFormats.UnicodeText)) { throw new NotImplementedException();//huqf //object o = null; //_editorControl.TextSelection.Paste(ref o, 0); } return VSConstants.S_OK; }
public int IsSupported(Microsoft.VisualStudio.OLE.Interop.IDataObject pDO) { // Create a OleDataObject from the input interface. OleDataObject oleData = new OleDataObject(pDO); // && editorControl.RichTextBoxControl.CanPaste(DataFormats.GetFormat(DataFormats.UnicodeText)) // Check if the data object is of type UnicodeText. if (oleData.GetDataPresent(DataFormats.UnicodeText)) { return VSConstants.S_OK; } // In all the other cases return S_FALSE return VSConstants.S_FALSE; }
/// <summary> /// The item picked. /// </summary> /// <param name="pDO"> /// The p do. /// </param> /// <returns> /// The <see cref="int"/>. /// </returns> public int ItemPicked(IDataObject pDO) { // Create a OleDataObject from the input interface. var oleData = new OleDataObject(pDO); // Check if the picked item is the one we can paste. if (oleData.GetDataPresent(DataFormats.UnicodeText)) { object o = null; this.EditorControl.TextSelection.Paste(ref o, 0); } return VSConstants.S_OK; }
public int ItemPicked(Microsoft.VisualStudio.OLE.Interop.IDataObject pDO) { // Create a OleDataObject from the input interface. OleDataObject oleData = new OleDataObject(pDO); // Check if the picked item is the one we can paste. if (oleData.GetDataPresent(DataFormats.UnicodeText)) { object o = null; } return VSConstants.S_OK; }