ClearCanvas.Desktop.View.WinForms.GalleryView.ExtractListViewItem(System.Windows.Forms.IDataObject)

Here are the examples of the csharp api class ClearCanvas.Desktop.View.WinForms.GalleryView.ExtractListViewItem(System.Windows.Forms.IDataObject) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

1. Example

Project: ClearCanvas
Source File: GalleryView.cs
private void OnItemDragEnter(object sender, DragEventArgs e)
		{
			if (ExtractListViewItem(e.Data) != null)
				e.Effect = e.AllowedEffect;
			else
				e.Effect = DragDropEffects.None;
		}

2. Example

Project: ClearCanvas
Source File: GalleryView.cs
private void OnItemDragOver(object sender, DragEventArgs e)
		{
			// Retrieve the client coordinate/n ..... /n //View Source file for more details /n }

3. Example

Project: ClearCanvas
Source File: GalleryView.cs
private void OnItemDragDrop(object sender, DragEventArgs e)
		{
			// Retrieve the index of the insertion mark;
			int targetIndex = _listView.InsertionMark.Index;

			// If the insertion mark is not visible, exit the method.
			if (targetIndex == -1)
			{
				return;
			}

			// If the insertion mark is to the right of the item with
			// the corresponding index, increment the target index.
			if (_listView.InsertionMark.AppearsAfterItem)
			{
				targetIndex++;
			}

			ListViewItem draggedItem = ExtractListViewItem(e.Data);
			int draggedIndex = draggedItem.Index;

			// Insert a copy of the dragged item at the target index.
			// A copy must be inserted before the original item is removed
			// to preserve item index values. 
			_listView.Items.Insert(targetIndex, (ListViewItem) draggedItem.Clone());

			// Remove the original copy of the dragged item.
			_listView.Items.Remove(draggedItem);

			_suppressGalleryChangeEvents = true;

			// Alter the index if removing before inserting will change the meaning of the target index
			if (draggedIndex < targetIndex)
				targetIndex--;

			object o = _gallery[draggedIndex];

			// Move the corresponding data object by removing the original dragged item.
			_gallery.RemoveAt(draggedIndex);

			// then inserting the dragged item
			_gallery.Insert(targetIndex, o);

			_suppressGalleryChangeEvents = false;
		}