ListView.InsertionMarkとは? わかりやすく解説

ListView.InsertionMark プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

ListView コントロール内で項目がドラッグされる場合目的ドロップ位置を示すために使用されるオブジェクト取得します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public ReadOnly Property
 InsertionMark As ListViewInsertionMark
Dim instance As ListView
Dim value As ListViewInsertionMark

value = instance.InsertionMark
public ListViewInsertionMark InsertionMark { get;
 }
public:
property ListViewInsertionMark^ InsertionMark {
    ListViewInsertionMark^ get ();
}
/** @property */
public ListViewInsertionMark get_InsertionMark ()
public function get InsertionMark
 () : ListViewInsertionMark

プロパティ
挿入マークを表す ListViewInsertionMark オブジェクト

解説解説

ListView 挿入マーク機能使用すると、ドラッグ アンド ドロップ操作で項目を新し位置までドラッグしたときに、ドロップ予定位置視覚的に示すことができます。この機能は、AutoArrange プロパティtrue設定されListView コントロールによって項目が自動的に並べ替えられない場合にのみ有効です。自動並べ替え実行されないようにするには、Sorting プロパティを SortOrder.None に設定しView プロパティを View.LargeIcon, View.SmallIcon またはView.Tile に設定する必要があります。さらに、挿入マーク機能ListView グループ化機能同時に使用できません。グループ化機能では、項目がグループメンバシップに従って並べられるためです。

一般的に、Control.DragOver イベントまたは Control.MouseMove イベントハンドラListViewInsertionMark クラス使用して、項目がドラッグされているときに挿入マーク位置更新します。これは、ドラッグしている項目を適切な位置挿入するために Control.DragDrop イベントまたは Control.MouseUp イベントハンドラでも使用されます。詳細については、「方法 : Windows フォーム ListView コントロール挿入マーク表示する」を参照してください

挿入マーク機能は、Windows XP および Windows Server 2003アプリケーションから Application.EnableVisualStyles メソッド呼び出す場合にのみ使用できます旧バージョンオペレーティング システムでは、挿入マークに関するコードがすべて無効になり、挿入マーク表示されません。その結果挿入マーク機能依存するコード正常に機能しない可能性あります

この機能使用できるかどうか確認し使用できない場合代替機能を提供するコード用意します。たとえば、挿入マークサポートしないオペレーティング システム実行する場合には、ドラッグ アンド ドロップによる項目の再配置実装するコードをすべてバイパスできます

挿入マーク機能は、オペレーティング システムテーマ機能提供しているライブラリと同じライブラリによって提供されます。このライブラリ使用できるかどうか確認するには、FeatureSupport.IsPresent(Object) メソッド オーバーロード呼び出し、OSFeature.Themes 値を渡します

使用例使用例

ListView挿入マーク機能使用方法次のコード例示します。この例では、標準ドラッグ イベント使用してドラッグ アンド ドロップによる項目の並べ替え実装しています。挿入マーク位置は、Control.DragOver イベントハンドラ更新されます。このハンドラでは、マウス ポインタ位置を、最も近くにある項目の中心比較しその結果使用して挿入マークを項目の右に表示するか、左に表示するかを決定してます。

Imports System
Imports System.Drawing
Imports System.Windows.Forms

Public Class ListViewInsertionMarkExample
    Inherits Form

    Private myListView As ListView
    
    Public Sub New()
        ' Initialize myListView.
        myListView = New ListView()
        myListView.Dock = DockStyle.Fill
        myListView.View = View.LargeIcon
        myListView.MultiSelect = False
        myListView.ListViewItemSorter = New ListViewIndexComparer()
        
        ' Initialize the insertion mark.
        myListView.InsertionMark.Color = Color.Green
        
        ' Add items to myListView.
        myListView.Items.Add("zero")
        myListView.Items.Add("one")
        myListView.Items.Add("two")
        myListView.Items.Add("three")
        myListView.Items.Add("four")
        myListView.Items.Add("five")
        
        ' Initialize the drag-and-drop operation when running
        ' under Windows XP or a later operating system.
        If OSFeature.Feature.IsPresent(OSFeature.Themes)
            myListView.AllowDrop = True
            AddHandler myListView.ItemDrag, AddressOf
 myListView_ItemDrag
            AddHandler myListView.DragEnter, AddressOf
 myListView_DragEnter
            AddHandler myListView.DragOver, AddressOf
 myListView_DragOver
            AddHandler myListView.DragLeave, AddressOf
 myListView_DragLeave
            AddHandler myListView.DragDrop, AddressOf
 myListView_DragDrop
        End If 

        ' Initialize the form.
        Me.Text = "ListView Insertion Mark
 Example"
        Me.Controls.Add(myListView)
    End Sub 'New

    <STAThread()> _
    Shared Sub Main()
        Application.EnableVisualStyles()
        Application.Run(New ListViewInsertionMarkExample())
    End Sub 'Main
    
    ' Starts the drag-and-drop operation when an item is dragged.
    Private Sub myListView_ItemDrag(sender
 As Object, e As ItemDragEventArgs)
        myListView.DoDragDrop(e.Item, DragDropEffects.Move)
    End Sub 'myListView_ItemDrag
    
    ' Sets the target drop effect.
    Private Sub myListView_DragEnter(sender
 As Object, e As DragEventArgs)
        e.Effect = e.AllowedEffect
    End Sub 'myListView_DragEnter
    
    ' Moves the insertion mark as the item is dragged.
    Private Sub myListView_DragOver(sender
 As Object, e As DragEventArgs)
        ' Retrieve the client coordinates of the mouse pointer.
        Dim targetPoint As Point = myListView.PointToClient(New
 Point(e.X, e.Y))
        
        ' Retrieve the index of the item closest to the mouse pointer.
        Dim targetIndex As Integer
 = _
            myListView.InsertionMark.NearestIndex(targetPoint)
        
        ' Confirm that the mouse pointer is not over the dragged item.
        If targetIndex > -1 Then
            ' Determine whether the mouse pointer is to the left or
            ' the right of the midpoint of the closest item and set
            ' the InsertionMark.AppearsAfterItem property accordingly.
            Dim itemBounds As Rectangle = myListView.GetItemRect(targetIndex)
            If targetPoint.X > itemBounds.Left + (itemBounds.Width
 / 2) Then
                myListView.InsertionMark.AppearsAfterItem = True
            Else
                myListView.InsertionMark.AppearsAfterItem = False
            End If
        End If
        
        ' Set the location of the insertion mark. If the mouse is
        ' over the dragged item, the targetIndex value is -1 and
        ' the insertion mark disappears.
        myListView.InsertionMark.Index = targetIndex
    End Sub 'myListView_DragOver

    ' Removes the insertion mark when the mouse leaves the control.
    Private Sub myListView_DragLeave(sender
 As Object, e As EventArgs)
        myListView.InsertionMark.Index = -1
    End Sub 'myListView_DragLeave
    
    ' Moves the item to the location of the insertion mark.
    Private Sub myListView_DragDrop(sender
 As Object, e As DragEventArgs)
        ' Retrieve the index of the insertion mark;
        Dim targetIndex As Integer
 = myListView.InsertionMark.Index
        
        ' If the insertion mark is not visible, exit the method.
        If targetIndex = -1 Then
            Return
        End If 

        ' If the insertion mark is to the right of the item with
        ' the corresponding index, increment the target index.
        If myListView.InsertionMark.AppearsAfterItem Then
            targetIndex += 1
        End If 

        ' Retrieve the dragged item.
        Dim draggedItem As ListViewItem = _
            CType(e.Data.GetData(GetType(ListViewItem)), ListViewItem)
        
        ' 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.
        myListView.Items.Insert(targetIndex, _
            CType(draggedItem.Clone(), ListViewItem))
        
        ' Remove the original copy of the dragged item.
        myListView.Items.Remove(draggedItem)

    End Sub 'myListView_DragDrop
    
    ' Sorts ListViewItem objects by index.    
    Private Class ListViewIndexComparer
        Implements System.Collections.IComparer
        
        Public Function Compare(x As
 Object, y As Object) As
 Integer _
            Implements System.Collections.IComparer.Compare
            Return CType(x, ListViewItem).Index - CType(y, ListViewItem).Index
        End Function 'Compare

    End Class 'ListViewIndexComparer

End Class 'ListViewInsertionMarkExample
 
using System;
using System.Drawing;
using System.Windows.Forms;

public class ListViewInsertionMarkExample :
 Form
{
    private ListView myListView; 

    public ListViewInsertionMarkExample()
    {
        // Initialize myListView.
        myListView = new ListView();
        myListView.Dock = DockStyle.Fill;
        myListView.View = View.LargeIcon;
        myListView.MultiSelect = false;
        myListView.ListViewItemSorter = new ListViewIndexComparer();

        // Initialize the insertion mark.
        myListView.InsertionMark.Color = Color.Green;

        // Add items to myListView.
        myListView.Items.Add("zero");
        myListView.Items.Add("one");
        myListView.Items.Add("two");
        myListView.Items.Add("three");
        myListView.Items.Add("four");
        myListView.Items.Add("five");
        
        // Initialize the drag-and-drop operation when running
        // under Windows XP or a later operating system.
        if (OSFeature.Feature.IsPresent(OSFeature.Themes))
        {
            myListView.AllowDrop = true;
            myListView.ItemDrag += new ItemDragEventHandler(myListView_ItemDrag);
            myListView.DragEnter += new DragEventHandler(myListView_DragEnter);
            myListView.DragOver += new DragEventHandler(myListView_DragOver);
            myListView.DragLeave += new EventHandler(myListView_DragLeave);
            myListView.DragDrop += new DragEventHandler(myListView_DragDrop);
        }

        // Initialize the form.
        this.Text = "ListView Insertion Mark Example";
        this.Controls.Add(myListView);
    }

    [STAThread]
    static void Main() 
    {
        Application.EnableVisualStyles();
        Application.Run(new ListViewInsertionMarkExample());
    }

    // Starts the drag-and-drop operation when an item is dragged.
    private void myListView_ItemDrag(object
 sender, ItemDragEventArgs e)
    {
        myListView.DoDragDrop(e.Item, DragDropEffects.Move);
    }

    // Sets the target drop effect.
    private void myListView_DragEnter(object
 sender, DragEventArgs e)
    {
        e.Effect = e.AllowedEffect;
    }

    // Moves the insertion mark as the item is dragged.
    private void myListView_DragOver(object
 sender, DragEventArgs e)
    {
        // Retrieve the client coordinates of the mouse pointer.
        Point targetPoint = 
            myListView.PointToClient(new Point(e.X, e.Y));

        // Retrieve the index of the item closest to the mouse pointer.
        int targetIndex = myListView.InsertionMark.NearestIndex(targetPoint);

        // Confirm that the mouse pointer is not over the dragged item.
        if (targetIndex > -1) 
        {
            // Determine whether the mouse pointer is to the left or
            // the right of the midpoint of the closest item and set
            // the InsertionMark.AppearsAfterItem property accordingly.
            Rectangle itemBounds = myListView.GetItemRect(targetIndex);
            if ( targetPoint.X > itemBounds.Left + (itemBounds.Width
 / 2) )
            {
                myListView.InsertionMark.AppearsAfterItem = true;
            }
            else
            {
                myListView.InsertionMark.AppearsAfterItem = false;
            }
        }

        // Set the location of the insertion mark. If the mouse is
        // over the dragged item, the targetIndex value is -1 and
        // the insertion mark disappears.
        myListView.InsertionMark.Index = targetIndex;
    }

    // Removes the insertion mark when the mouse leaves the control.
    private void myListView_DragLeave(object
 sender, EventArgs e)
    {
        myListView.InsertionMark.Index = -1;
    }

    // Moves the item to the location of the insertion mark.
    private void myListView_DragDrop(object
 sender, DragEventArgs e)
    {
        // Retrieve the index of the insertion mark;
        int targetIndex = myListView.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 (myListView.InsertionMark.AppearsAfterItem) 
        {
            targetIndex++;
        }

        // Retrieve the dragged item.
        ListViewItem draggedItem = 
            (ListViewItem)e.Data.GetData(typeof(ListViewItem));

        // 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. 
        myListView.Items.Insert(
            targetIndex, (ListViewItem)draggedItem.Clone());

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

    // Sorts ListViewItem objects by index.
    private class ListViewIndexComparer : System.Collections.IComparer
    {
        public int Compare(object x, object
 y)
        {
            return ((ListViewItem)x).Index - ((ListViewItem)y).Index;
        }
    }

}
#using <System.dll>
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>

using namespace System;
using namespace System::Drawing;
using namespace System::Windows::Forms;
public ref class ListViewInsertionMarkExample:
 public Form
{
private:
   ListView^ myListView;

public:

   ListViewInsertionMarkExample()
   {
      // Initialize myListView.
      myListView = gcnew ListView;
      myListView->Dock = DockStyle::Fill;
      myListView->View = View::LargeIcon;
      myListView->MultiSelect = false;
      myListView->ListViewItemSorter = gcnew ListViewIndexComparer;

      // Initialize the insertion mark.
      myListView->InsertionMark->Color = Color::Green;

      // Add items to myListView.
      myListView->Items->Add( "zero" );
      myListView->Items->Add( "one" );
      myListView->Items->Add( "two" );
      myListView->Items->Add( "three" );
      myListView->Items->Add( "four" );
      myListView->Items->Add( "five" );

      // Initialize the drag-and-drop operation when running
      // under Windows XP or a later operating system.
      if ( System::Environment::OSVersion->Version->Major
 > 5 || (System::Environment::OSVersion->Version->Major == 5 &&
 System::Environment::OSVersion->Version->Minor >= 1) )
      {
         myListView->AllowDrop = true;
         myListView->ItemDrag += gcnew ItemDragEventHandler( this,
 &ListViewInsertionMarkExample::myListView_ItemDrag );
         myListView->DragEnter += gcnew DragEventHandler( this,
 &ListViewInsertionMarkExample::myListView_DragEnter );
         myListView->DragOver += gcnew DragEventHandler( this,
 &ListViewInsertionMarkExample::myListView_DragOver );
         myListView->DragLeave += gcnew EventHandler( this,
 &ListViewInsertionMarkExample::myListView_DragLeave );
         myListView->DragDrop += gcnew DragEventHandler( this,
 &ListViewInsertionMarkExample::myListView_DragDrop );
      }

      // Initialize the form.
      this->Text = "ListView Insertion Mark Example";
      this->Controls->Add( myListView );
   }

private:

   // Starts the drag-and-drop operation when an item is dragged.
   void myListView_ItemDrag( Object^ /*sender*/, ItemDragEventArgs^
 e )
   {
      myListView->DoDragDrop( e->Item, DragDropEffects::Move );
   }

   // Sets the target drop effect.
   void myListView_DragEnter( Object^ /*sender*/, DragEventArgs^
 e )
   {
      e->Effect = e->AllowedEffect;
   }

   // Moves the insertion mark as the item is dragged.
   void myListView_DragOver( Object^ /*sender*/, DragEventArgs^
 e )
   {
      // Retrieve the client coordinates of the mouse pointer.
      Point targetPoint = myListView->PointToClient( Point(e->X,e->Y) );

      // Retrieve the index of the item closest to the mouse pointer.
      int targetIndex = myListView->InsertionMark->NearestIndex(
 targetPoint );

      // Confirm that the mouse pointer is not over the dragged item.
      if ( targetIndex > -1 )
      {
         // Determine whether the mouse pointer is to the left or
         // the right of the midpoint of the closest item and set
         // the InsertionMark.AppearsAfterItem property accordingly.
         Rectangle itemBounds = myListView->GetItemRect( targetIndex );
         if ( targetPoint.X > itemBounds.Left + (itemBounds.Width
 / 2) )
         {
            myListView->InsertionMark->AppearsAfterItem = true;
         }
         else
         {
            myListView->InsertionMark->AppearsAfterItem = false;
         }
      }

      // Set the location of the insertion mark. If the mouse is
      // over the dragged item, the targetIndex value is -1 and
      // the insertion mark disappears.
      myListView->InsertionMark->Index = targetIndex;
   }

   // Removes the insertion mark when the mouse leaves the control.
   void myListView_DragLeave( Object^ /*sender*/, EventArgs^ /*e*/
 )
   {
      myListView->InsertionMark->Index = -1;
   }

   // Moves the item to the location of the insertion mark.
   void myListView_DragDrop( Object^ /*sender*/, DragEventArgs^
 e )
   {
      // Retrieve the index of the insertion mark;
      int targetIndex = myListView->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 ( myListView->InsertionMark->AppearsAfterItem )
      {
         targetIndex++;
      }

      // Retrieve the dragged item.
      ListViewItem^ draggedItem = dynamic_cast<ListViewItem^>(e->Data->GetData(
 ListViewItem::typeid ));

      // 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.
      myListView->Items->Insert( targetIndex, dynamic_cast<ListViewItem^>(draggedItem->Clone())
 );

      // Remove the original copy of the dragged item.
      myListView->Items->Remove( draggedItem );

   }

   // Sorts ListViewItem objects by index.
   ref class ListViewIndexComparer: public
 System::Collections::IComparer
   {
   public:
      virtual int Compare( Object^ x, Object^ y )
      {
         return (dynamic_cast<ListViewItem^>(x))->Index
 - (dynamic_cast<ListViewItem^>(y))->Index;
      }
   };
};

[STAThread]
int main()
{
   Application::EnableVisualStyles();
   Application::Run( gcnew ListViewInsertionMarkExample );
}
import System.*;
import System.Drawing.*;
import System.Windows.Forms.*;

public class ListViewInsertionMarkExample extends
 Form
{
    private ListView myListView;

    public ListViewInsertionMarkExample()
    {
        // Initialize myListView.
        myListView = new ListView();
        myListView.set_Dock(DockStyle.Fill);
        myListView.set_View(View.LargeIcon);
        myListView.set_MultiSelect(false);
        myListView.set_ListViewItemSorter(new ListViewIndexComparer());
        // Initialize the insertion mark.
        myListView.get_InsertionMark().set_Color(Color.get_Green());
        // Add items to myListView.
        myListView.get_Items().Add("zero");
        myListView.get_Items().Add("one");
        myListView.get_Items().Add("two");
        myListView.get_Items().Add("three");
        myListView.get_Items().Add("four");
        myListView.get_Items().Add("five");
        // Initialize the drag-and-drop operation when running
        // under Windows XP or a later operating system.
        if (System.Environment.get_OSVersion().get_Version().get_Major()
 > 5 
            || (System.Environment.get_OSVersion().get_Version().get_Major() 
            == 5 && System.Environment.get_OSVersion().get_Version().
            get_Minor() >= 1)) {
            myListView.set_AllowDrop(true);
            myListView.add_ItemDrag(new ItemDragEventHandler(
                myListView_ItemDrag));
            myListView.add_DragEnter(new DragEventHandler(
                myListView_DragEnter));
            myListView.add_DragOver(new DragEventHandler(myListView_DragOver));
            myListView.add_DragLeave(new EventHandler(myListView_DragLeave));
            myListView.add_DragDrop(new DragEventHandler(myListView_DragDrop));
        }
        // Initialize the form.
        this.set_Text("ListView Insertion Mark Example");
        this.get_Controls().Add(myListView);
    } //ListViewInsertionMarkExample

    /** @attribute STAThread()
     */
    public static void main(String[]
 args)
    {
        Application.Run(new ListViewInsertionMarkExample());
    } //main

    // Starts the drag-and-drop operation when an item is dragged.
    private void myListView_ItemDrag(Object
 sender, ItemDragEventArgs e)
    {
        myListView.DoDragDrop(e.get_Item(), DragDropEffects.Move);
    } //myListView_ItemDrag

    // Sets the target drop effect.
    private void myListView_DragEnter(Object
 sender, DragEventArgs e)
    {
        e.set_Effect(e.get_AllowedEffect());
    } //myListView_DragEnter

    // Moves the insertion mark as the item is dragged.
    private void myListView_DragOver(Object
 sender, DragEventArgs e)
    {
        // Retrieve the client coordinates of the mouse pointer.
        Point targetPoint = myListView.PointToClient(
              new Point(e.get_X(), e.get_Y()));
        // Retrieve the index of the item closest to the mouse pointer.
        int targetIndex = myListView.get_InsertionMark().
            NearestIndex(targetPoint);
        // Confirm that the mouse pointer is not over the dragged item.
        if (targetIndex > -1) {
            // Determine whether the mouse pointer is to the left or
            // the right of the midpoint of the closest item and set
            // the InsertionMark.AppearsAfterItem property accordingly.
            Rectangle itemBounds = myListView.GetItemRect(targetIndex);
            if (targetPoint.get_X() > itemBounds.get_Left()
 
                + itemBounds.get_Width() / 2) {
                myListView.get_InsertionMark().set_AppearsAfterItem(true);
            }
            else {
                myListView.get_InsertionMark().set_AppearsAfterItem(false);
            }
        }
        // Set the location of the insertion mark. If the mouse is
        // over the dragged item, the targetIndex value is -1 and
        // the insertion mark disappears.
        myListView.get_InsertionMark().set_Index(targetIndex);
    } //myListView_DragOver

    // Removes the insertion mark when the mouse leaves the control.
    private void myListView_DragLeave(Object
 sender, EventArgs e)
    {
        myListView.get_InsertionMark().set_Index(-1);
    } //myListView_DragLeave

    // Moves the item to the location of the insertion mark.
    private void myListView_DragDrop(Object
 sender, DragEventArgs e)
    {
        // Retrieve the index of the insertion mark;
        int targetIndex = myListView.get_InsertionMark().get_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 (myListView.get_InsertionMark().get_AppearsAfterItem())
 {
            targetIndex++;
        }
        // Retrieve the dragged item.
        ListViewItem draggedItem = (ListViewItem)(e.get_Data().GetData(
                     ListViewItem.class.ToType()));
        // 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.
        myListView.get_Items().Insert(targetIndex, (ListViewItem)
            draggedItem.Clone());
        // Remove the original copy of the dragged item.
        myListView.get_Items().Remove(draggedItem);
    } //myListView_DragDrop

    // Sorts ListViewItem objects by index.
    private class ListViewIndexComparer 
        implements System.Collections.IComparer
    {
        public int Compare(Object x, Object
 y)
        {
            return ((ListViewItem)x).get_Index() 
                - ((ListViewItem)y).get_Index();
        } //Compare
    } //ListViewIndexComparer
} //ListViewInsertionMarkExample 
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ListView クラス
ListView メンバ
System.Windows.Forms 名前空間
ListViewInsertionMark
Application.EnableVisualStyles

ListViewInsertionMark クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

ListView コントロールで項目を新し位置ドラッグしたときに、ドロップ予定位置を示すために使用されます。この機能は、Windows XP 以降のみで使用できます

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public NotInheritable Class
 ListViewInsertionMark
Dim instance As ListViewInsertionMark
public sealed class ListViewInsertionMark
public ref class ListViewInsertionMark sealed
public final class ListViewInsertionMark
public final class ListViewInsertionMark
解説解説

ListView コントロールの InsertionMark プロパティから取得できる ListViewInsertionMark使用すると、ドラッグ アンド ドロップ操作で項目を新し位置までドラッグしたときに、ドロップ予定位置視覚的に示すことができます

この機能は、ListView.AutoArrange プロパティtrue設定されListView コントロールによって項目が自動的に並べ替えられない場合にのみ有効です。自動並べ替え実行されないようにするには、ListView.Sorting プロパティを SortOrder.None に設定し、ListView.View プロパティを View.LargeIcon, View.SmallIcon またはView.Tile に設定する必要があります。さらに、挿入マーク機能ListView グループ化機能同時に使用できません。グループ化機能では、項目がグループメンバシップに従って並べられるためです。

一般的に、Control.DragOver イベントまたは Control.MouseMove イベントハンドラListViewInsertionMark クラス使用して、項目がドラッグされているときに挿入マーク位置更新します。これは、ドラッグしている項目を適切な位置挿入するために Control.DragDrop イベントまたは Control.MouseUp イベントハンドラでも使用されます。

Control.DragOver イベント ハンドラまたは Control.MouseMove イベント ハンドラでは、通常

挿入マーク位置更新するには、次の手順実行します

  1. Control.DragOver イベントまたは Control.MouseMove イベントハンドラで、ListView.InsertionMark プロパティ使用して ListView コントロール関連付けられている ListViewInsertionMark オブジェクトアクセスます。

  2. NearestIndex メソッド使用してマウス ポインタ最も近い項目のインデックス取得します

  3. そのインデックス値を ListView.GetItemRect メソッド渡し、項目に外接する四角形取得します

  4. 外接する四角形中心点から左側マウス ポインタ置かれている場合、AppearsAfterItem プロパティfalse設定しますそれ以外場合true設定します

  5. Index プロパティに、NearestIndex メソッドから取得したインデックス値を設定しますAppearsAfterItem プロパティの値に応じて指定されインデックスを持つ項目の左側または右側挿入マーク表示されます。項目をその項目自体の上ドラッグすると、インデックスは -1 となり、挿入マークが非表示なります

ドラッグしている項目を正し位置挿入するには、次の手順実行します

  1. Control.DragDrop イベントまたは Control.MouseUp イベントハンドラで、Index プロパティ使用して挿入マーク現在位置判断します。この値は、後で挿入インデックスとして使用するために格納しておきます

  2. AppearsAfterItem プロパティtrue設定されている場合格納されている挿入インデックスの値が増分されます

  3. ListView.ListViewItemCollection.Insert メソッド使用して、ListView.Items コレクション格納されている挿入インデックス位置に、ドラッグしている項目の複製挿入します

  4. ListView.ListViewItemCollection.Remove メソッド使用してドラッグしている項目のドラッグ元を削除します

挿入前に ListView.Items コレクションインデックス値が変更されないように、ドラッグしている項目の複製挿入した後でドラッグ元を削除する必要があります

Color プロパティ使用すると、挿入マークの色を変更できます挿入マークサイズ位置を知る必要がある場合には、Bounds プロパティ使って外接する四角形取得できます

メモメモ

挿入マーク機能は、Windows XP および Windows Server 2003 ファミリアプリケーションから Application.EnableVisualStyles メソッド呼び出す場合にのみ使用できます旧バージョンオペレーティング システムでは、挿入マークに関するコードがすべて無視され挿入マーク表示されません。その結果挿入マーク機能依存するコード正常に機能しない可能性あります挿入マーク機能使用できるかどうか確認し使用できない場合代替機能を提供するテスト機能用意します。たとえば、挿入マークサポートしないオペレーティング システム実行する場合には、ドラッグ アンド ドロップによる項目の再配置実装するコードをすべてバイパスできます

挿入マーク機能は、オペレーティング システムテーマ機能提供しているライブラリと同じライブラリによって提供されます。このライブラリ使用できるかどうか確認するには、FeatureSupport.IsPresent(Object) メソッド オーバーロード呼び出し、OSFeature.Themes 値を渡します

使用例使用例

ListView挿入マーク機能使用し標準ドラッグ イベント使ったドラッグ アンド ドロップ項目の並べ替え実装する方法次のコード例示します挿入マーク位置は、Control.DragOver イベントハンドラ更新されます。このハンドラでは、マウス ポインタ位置を、最も近くにある項目の中心比較しその結果使用して挿入マークを項目の右に表示するか、左に表示するかを決定してます。

Imports System
Imports System.Drawing
Imports System.Windows.Forms

Public Class ListViewInsertionMarkExample
    Inherits Form

    Private myListView As ListView
    
    Public Sub New()
        ' Initialize myListView.
        myListView = New ListView()
        myListView.Dock = DockStyle.Fill
        myListView.View = View.LargeIcon
        myListView.MultiSelect = False
        myListView.ListViewItemSorter = New ListViewIndexComparer()
        
        ' Initialize the insertion mark.
        myListView.InsertionMark.Color = Color.Green
        
        ' Add items to myListView.
        myListView.Items.Add("zero")
        myListView.Items.Add("one")
        myListView.Items.Add("two")
        myListView.Items.Add("three")
        myListView.Items.Add("four")
        myListView.Items.Add("five")
        
        ' Initialize the drag-and-drop operation when running
        ' under Windows XP or a later operating system.
        If OSFeature.Feature.IsPresent(OSFeature.Themes)
            myListView.AllowDrop = True
            AddHandler myListView.ItemDrag, AddressOf
 myListView_ItemDrag
            AddHandler myListView.DragEnter, AddressOf
 myListView_DragEnter
            AddHandler myListView.DragOver, AddressOf
 myListView_DragOver
            AddHandler myListView.DragLeave, AddressOf
 myListView_DragLeave
            AddHandler myListView.DragDrop, AddressOf
 myListView_DragDrop
        End If 

        ' Initialize the form.
        Me.Text = "ListView Insertion Mark
 Example"
        Me.Controls.Add(myListView)
    End Sub 'New

    <STAThread()> _
    Shared Sub Main()
        Application.EnableVisualStyles()
        Application.Run(New ListViewInsertionMarkExample())
    End Sub 'Main
    
    ' Starts the drag-and-drop operation when an item is dragged.
    Private Sub myListView_ItemDrag(sender
 As Object, e As ItemDragEventArgs)
        myListView.DoDragDrop(e.Item, DragDropEffects.Move)
    End Sub 'myListView_ItemDrag
    
    ' Sets the target drop effect.
    Private Sub myListView_DragEnter(sender
 As Object, e As DragEventArgs)
        e.Effect = e.AllowedEffect
    End Sub 'myListView_DragEnter
    
    ' Moves the insertion mark as the item is dragged.
    Private Sub myListView_DragOver(sender
 As Object, e As DragEventArgs)
        ' Retrieve the client coordinates of the mouse pointer.
        Dim targetPoint As Point = myListView.PointToClient(New
 Point(e.X, e.Y))
        
        ' Retrieve the index of the item closest to the mouse pointer.
        Dim targetIndex As Integer
 = _
            myListView.InsertionMark.NearestIndex(targetPoint)
        
        ' Confirm that the mouse pointer is not over the dragged item.
        If targetIndex > -1 Then
            ' Determine whether the mouse pointer is to the left or
            ' the right of the midpoint of the closest item and set
            ' the InsertionMark.AppearsAfterItem property accordingly.
            Dim itemBounds As Rectangle = myListView.GetItemRect(targetIndex)
            If targetPoint.X > itemBounds.Left + (itemBounds.Width
 / 2) Then
                myListView.InsertionMark.AppearsAfterItem = True
            Else
                myListView.InsertionMark.AppearsAfterItem = False
            End If
        End If
        
        ' Set the location of the insertion mark. If the mouse is
        ' over the dragged item, the targetIndex value is -1 and
        ' the insertion mark disappears.
        myListView.InsertionMark.Index = targetIndex
    End Sub 'myListView_DragOver

    ' Removes the insertion mark when the mouse leaves the control.
    Private Sub myListView_DragLeave(sender
 As Object, e As EventArgs)
        myListView.InsertionMark.Index = -1
    End Sub 'myListView_DragLeave
    
    ' Moves the item to the location of the insertion mark.
    Private Sub myListView_DragDrop(sender
 As Object, e As DragEventArgs)
        ' Retrieve the index of the insertion mark;
        Dim targetIndex As Integer
 = myListView.InsertionMark.Index
        
        ' If the insertion mark is not visible, exit the method.
        If targetIndex = -1 Then
            Return
        End If 

        ' If the insertion mark is to the right of the item with
        ' the corresponding index, increment the target index.
        If myListView.InsertionMark.AppearsAfterItem Then
            targetIndex += 1
        End If 

        ' Retrieve the dragged item.
        Dim draggedItem As ListViewItem = _
            CType(e.Data.GetData(GetType(ListViewItem)), ListViewItem)
        
        ' 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.
        myListView.Items.Insert(targetIndex, _
            CType(draggedItem.Clone(), ListViewItem))
        
        ' Remove the original copy of the dragged item.
        myListView.Items.Remove(draggedItem)

    End Sub 'myListView_DragDrop
    
    ' Sorts ListViewItem objects by index.    
    Private Class ListViewIndexComparer
        Implements System.Collections.IComparer
        
        Public Function Compare(x As
 Object, y As Object) As
 Integer _
            Implements System.Collections.IComparer.Compare
            Return CType(x, ListViewItem).Index - CType(y, ListViewItem).Index
        End Function 'Compare

    End Class 'ListViewIndexComparer

End Class 'ListViewInsertionMarkExample
 
using System;
using System.Drawing;
using System.Windows.Forms;

public class ListViewInsertionMarkExample :
 Form
{
    private ListView myListView; 

    public ListViewInsertionMarkExample()
    {
        // Initialize myListView.
        myListView = new ListView();
        myListView.Dock = DockStyle.Fill;
        myListView.View = View.LargeIcon;
        myListView.MultiSelect = false;
        myListView.ListViewItemSorter = new ListViewIndexComparer();

        // Initialize the insertion mark.
        myListView.InsertionMark.Color = Color.Green;

        // Add items to myListView.
        myListView.Items.Add("zero");
        myListView.Items.Add("one");
        myListView.Items.Add("two");
        myListView.Items.Add("three");
        myListView.Items.Add("four");
        myListView.Items.Add("five");
        
        // Initialize the drag-and-drop operation when running
        // under Windows XP or a later operating system.
        if (OSFeature.Feature.IsPresent(OSFeature.Themes))
        {
            myListView.AllowDrop = true;
            myListView.ItemDrag += new ItemDragEventHandler(myListView_ItemDrag);
            myListView.DragEnter += new DragEventHandler(myListView_DragEnter);
            myListView.DragOver += new DragEventHandler(myListView_DragOver);
            myListView.DragLeave += new EventHandler(myListView_DragLeave);
            myListView.DragDrop += new DragEventHandler(myListView_DragDrop);
        }

        // Initialize the form.
        this.Text = "ListView Insertion Mark Example";
        this.Controls.Add(myListView);
    }

    [STAThread]
    static void Main() 
    {
        Application.EnableVisualStyles();
        Application.Run(new ListViewInsertionMarkExample());
    }

    // Starts the drag-and-drop operation when an item is dragged.
    private void myListView_ItemDrag(object
 sender, ItemDragEventArgs e)
    {
        myListView.DoDragDrop(e.Item, DragDropEffects.Move);
    }

    // Sets the target drop effect.
    private void myListView_DragEnter(object
 sender, DragEventArgs e)
    {
        e.Effect = e.AllowedEffect;
    }

    // Moves the insertion mark as the item is dragged.
    private void myListView_DragOver(object
 sender, DragEventArgs e)
    {
        // Retrieve the client coordinates of the mouse pointer.
        Point targetPoint = 
            myListView.PointToClient(new Point(e.X, e.Y));

        // Retrieve the index of the item closest to the mouse pointer.
        int targetIndex = myListView.InsertionMark.NearestIndex(targetPoint);

        // Confirm that the mouse pointer is not over the dragged item.
        if (targetIndex > -1) 
        {
            // Determine whether the mouse pointer is to the left or
            // the right of the midpoint of the closest item and set
            // the InsertionMark.AppearsAfterItem property accordingly.
            Rectangle itemBounds = myListView.GetItemRect(targetIndex);
            if ( targetPoint.X > itemBounds.Left + (itemBounds.Width
 / 2) )
            {
                myListView.InsertionMark.AppearsAfterItem = true;
            }
            else
            {
                myListView.InsertionMark.AppearsAfterItem = false;
            }
        }

        // Set the location of the insertion mark. If the mouse is
        // over the dragged item, the targetIndex value is -1 and
        // the insertion mark disappears.
        myListView.InsertionMark.Index = targetIndex;
    }

    // Removes the insertion mark when the mouse leaves the control.
    private void myListView_DragLeave(object
 sender, EventArgs e)
    {
        myListView.InsertionMark.Index = -1;
    }

    // Moves the item to the location of the insertion mark.
    private void myListView_DragDrop(object
 sender, DragEventArgs e)
    {
        // Retrieve the index of the insertion mark;
        int targetIndex = myListView.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 (myListView.InsertionMark.AppearsAfterItem) 
        {
            targetIndex++;
        }

        // Retrieve the dragged item.
        ListViewItem draggedItem = 
            (ListViewItem)e.Data.GetData(typeof(ListViewItem));

        // 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. 
        myListView.Items.Insert(
            targetIndex, (ListViewItem)draggedItem.Clone());

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

    // Sorts ListViewItem objects by index.
    private class ListViewIndexComparer : System.Collections.IComparer
    {
        public int Compare(object x, object
 y)
        {
            return ((ListViewItem)x).Index - ((ListViewItem)y).Index;
        }
    }

}
#using <System.dll>
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>

using namespace System;
using namespace System::Drawing;
using namespace System::Windows::Forms;
public ref class ListViewInsertionMarkExample:
 public Form
{
private:
   ListView^ myListView;

public:

   ListViewInsertionMarkExample()
   {
      // Initialize myListView.
      myListView = gcnew ListView;
      myListView->Dock = DockStyle::Fill;
      myListView->View = View::LargeIcon;
      myListView->MultiSelect = false;
      myListView->ListViewItemSorter = gcnew ListViewIndexComparer;

      // Initialize the insertion mark.
      myListView->InsertionMark->Color = Color::Green;

      // Add items to myListView.
      myListView->Items->Add( "zero" );
      myListView->Items->Add( "one" );
      myListView->Items->Add( "two" );
      myListView->Items->Add( "three" );
      myListView->Items->Add( "four" );
      myListView->Items->Add( "five" );

      // Initialize the drag-and-drop operation when running
      // under Windows XP or a later operating system.
      if ( System::Environment::OSVersion->Version->Major
 > 5 || (System::Environment::OSVersion->Version->Major == 5 &&
 System::Environment::OSVersion->Version->Minor >= 1) )
      {
         myListView->AllowDrop = true;
         myListView->ItemDrag += gcnew ItemDragEventHandler( this,
 &ListViewInsertionMarkExample::myListView_ItemDrag );
         myListView->DragEnter += gcnew DragEventHandler( this,
 &ListViewInsertionMarkExample::myListView_DragEnter );
         myListView->DragOver += gcnew DragEventHandler( this,
 &ListViewInsertionMarkExample::myListView_DragOver );
         myListView->DragLeave += gcnew EventHandler( this,
 &ListViewInsertionMarkExample::myListView_DragLeave );
         myListView->DragDrop += gcnew DragEventHandler( this,
 &ListViewInsertionMarkExample::myListView_DragDrop );
      }

      // Initialize the form.
      this->Text = "ListView Insertion Mark Example";
      this->Controls->Add( myListView );
   }

private:

   // Starts the drag-and-drop operation when an item is dragged.
   void myListView_ItemDrag( Object^ /*sender*/, ItemDragEventArgs^
 e )
   {
      myListView->DoDragDrop( e->Item, DragDropEffects::Move );
   }

   // Sets the target drop effect.
   void myListView_DragEnter( Object^ /*sender*/, DragEventArgs^
 e )
   {
      e->Effect = e->AllowedEffect;
   }

   // Moves the insertion mark as the item is dragged.
   void myListView_DragOver( Object^ /*sender*/, DragEventArgs^
 e )
   {
      // Retrieve the client coordinates of the mouse pointer.
      Point targetPoint = myListView->PointToClient( Point(e->X,e->Y) );

      // Retrieve the index of the item closest to the mouse pointer.
      int targetIndex = myListView->InsertionMark->NearestIndex(
 targetPoint );

      // Confirm that the mouse pointer is not over the dragged item.
      if ( targetIndex > -1 )
      {
         // Determine whether the mouse pointer is to the left or
         // the right of the midpoint of the closest item and set
         // the InsertionMark.AppearsAfterItem property accordingly.
         Rectangle itemBounds = myListView->GetItemRect( targetIndex );
         if ( targetPoint.X > itemBounds.Left + (itemBounds.Width
 / 2) )
         {
            myListView->InsertionMark->AppearsAfterItem = true;
         }
         else
         {
            myListView->InsertionMark->AppearsAfterItem = false;
         }
      }

      // Set the location of the insertion mark. If the mouse is
      // over the dragged item, the targetIndex value is -1 and
      // the insertion mark disappears.
      myListView->InsertionMark->Index = targetIndex;
   }

   // Removes the insertion mark when the mouse leaves the control.
   void myListView_DragLeave( Object^ /*sender*/, EventArgs^ /*e*/
 )
   {
      myListView->InsertionMark->Index = -1;
   }

   // Moves the item to the location of the insertion mark.
   void myListView_DragDrop( Object^ /*sender*/, DragEventArgs^
 e )
   {
      // Retrieve the index of the insertion mark;
      int targetIndex = myListView->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 ( myListView->InsertionMark->AppearsAfterItem )
      {
         targetIndex++;
      }

      // Retrieve the dragged item.
      ListViewItem^ draggedItem = dynamic_cast<ListViewItem^>(e->Data->GetData(
 ListViewItem::typeid ));

      // 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.
      myListView->Items->Insert( targetIndex, dynamic_cast<ListViewItem^>(draggedItem->Clone())
 );

      // Remove the original copy of the dragged item.
      myListView->Items->Remove( draggedItem );

   }

   // Sorts ListViewItem objects by index.
   ref class ListViewIndexComparer: public
 System::Collections::IComparer
   {
   public:
      virtual int Compare( Object^ x, Object^ y )
      {
         return (dynamic_cast<ListViewItem^>(x))->Index
 - (dynamic_cast<ListViewItem^>(y))->Index;
      }
   };
};

[STAThread]
int main()
{
   Application::EnableVisualStyles();
   Application::Run( gcnew ListViewInsertionMarkExample );
}
import System.*;
import System.Drawing.*;
import System.Windows.Forms.*;

public class ListViewInsertionMarkExample extends
 Form
{
    private ListView myListView;

    public ListViewInsertionMarkExample()
    {
        // Initialize myListView.
        myListView = new ListView();
        myListView.set_Dock(DockStyle.Fill);
        myListView.set_View(View.LargeIcon);
        myListView.set_MultiSelect(false);
        myListView.set_ListViewItemSorter(new ListViewIndexComparer());
        // Initialize the insertion mark.
        myListView.get_InsertionMark().set_Color(Color.get_Green());
        // Add items to myListView.
        myListView.get_Items().Add("zero");
        myListView.get_Items().Add("one");
        myListView.get_Items().Add("two");
        myListView.get_Items().Add("three");
        myListView.get_Items().Add("four");
        myListView.get_Items().Add("five");
        // Initialize the drag-and-drop operation when running
        // under Windows XP or a later operating system.
        if (System.Environment.get_OSVersion().get_Version().get_Major()
 > 5 
            || (System.Environment.get_OSVersion().get_Version().get_Major() 
            == 5 && System.Environment.get_OSVersion().get_Version().
            get_Minor() >= 1)) {
            myListView.set_AllowDrop(true);
            myListView.add_ItemDrag(new ItemDragEventHandler(
                myListView_ItemDrag));
            myListView.add_DragEnter(new DragEventHandler(
                myListView_DragEnter));
            myListView.add_DragOver(new DragEventHandler(myListView_DragOver));
            myListView.add_DragLeave(new EventHandler(myListView_DragLeave));
            myListView.add_DragDrop(new DragEventHandler(myListView_DragDrop));
        }
        // Initialize the form.
        this.set_Text("ListView Insertion Mark Example");
        this.get_Controls().Add(myListView);
    } //ListViewInsertionMarkExample

    /** @attribute STAThread()
     */
    public static void main(String[]
 args)
    {
        Application.Run(new ListViewInsertionMarkExample());
    } //main

    // Starts the drag-and-drop operation when an item is dragged.
    private void myListView_ItemDrag(Object
 sender, ItemDragEventArgs e)
    {
        myListView.DoDragDrop(e.get_Item(), DragDropEffects.Move);
    } //myListView_ItemDrag

    // Sets the target drop effect.
    private void myListView_DragEnter(Object
 sender, DragEventArgs e)
    {
        e.set_Effect(e.get_AllowedEffect());
    } //myListView_DragEnter

    // Moves the insertion mark as the item is dragged.
    private void myListView_DragOver(Object
 sender, DragEventArgs e)
    {
        // Retrieve the client coordinates of the mouse pointer.
        Point targetPoint = myListView.PointToClient(
              new Point(e.get_X(), e.get_Y()));
        // Retrieve the index of the item closest to the mouse pointer.
        int targetIndex = myListView.get_InsertionMark().
            NearestIndex(targetPoint);
        // Confirm that the mouse pointer is not over the dragged item.
        if (targetIndex > -1) {
            // Determine whether the mouse pointer is to the left or
            // the right of the midpoint of the closest item and set
            // the InsertionMark.AppearsAfterItem property accordingly.
            Rectangle itemBounds = myListView.GetItemRect(targetIndex);
            if (targetPoint.get_X() > itemBounds.get_Left()
 
                + itemBounds.get_Width() / 2) {
                myListView.get_InsertionMark().set_AppearsAfterItem(true);
            }
            else {
                myListView.get_InsertionMark().set_AppearsAfterItem(false);
            }
        }
        // Set the location of the insertion mark. If the mouse is
        // over the dragged item, the targetIndex value is -1 and
        // the insertion mark disappears.
        myListView.get_InsertionMark().set_Index(targetIndex);
    } //myListView_DragOver

    // Removes the insertion mark when the mouse leaves the control.
    private void myListView_DragLeave(Object
 sender, EventArgs e)
    {
        myListView.get_InsertionMark().set_Index(-1);
    } //myListView_DragLeave

    // Moves the item to the location of the insertion mark.
    private void myListView_DragDrop(Object
 sender, DragEventArgs e)
    {
        // Retrieve the index of the insertion mark;
        int targetIndex = myListView.get_InsertionMark().get_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 (myListView.get_InsertionMark().get_AppearsAfterItem())
 {
            targetIndex++;
        }
        // Retrieve the dragged item.
        ListViewItem draggedItem = (ListViewItem)(e.get_Data().GetData(
                     ListViewItem.class.ToType()));
        // 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.
        myListView.get_Items().Insert(targetIndex, (ListViewItem)
            draggedItem.Clone());
        // Remove the original copy of the dragged item.
        myListView.get_Items().Remove(draggedItem);
    } //myListView_DragDrop

    // Sorts ListViewItem objects by index.
    private class ListViewIndexComparer 
        implements System.Collections.IComparer
    {
        public int Compare(Object x, Object
 y)
        {
            return ((ListViewItem)x).get_Index() 
                - ((ListViewItem)y).get_Index();
        } //Compare
    } //ListViewIndexComparer
} //ListViewInsertionMarkExample 
継承階層継承階層
System.Object
  System.Windows.Forms.ListViewInsertionMark
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

ListViewInsertionMark プロパティ


ListViewInsertionMark メソッド


ListViewInsertionMark メンバ

ListView コントロールで項目を新し位置ドラッグしたときに、ドロップ予定位置を示すために使用されます。この機能は、Windows XP 以降のみで使用できます

ListViewInsertionMark データ型公開されるメンバを以下の表に示します


パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

ListViewInsertionMark クラス
System.Windows.Forms 名前空間
ListView クラス


このページでは「.NET Framework クラス ライブラリ リファレンス」からListView.InsertionMarkを検索した結果を表示しています。
Weblioに収録されているすべての辞書からListView.InsertionMarkを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からListView.InsertionMark を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「ListView.InsertionMark」の関連用語

ListView.InsertionMarkのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ListView.InsertionMarkのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS