ToolStrip.EndDrag イベントとは? わかりやすく解説

ToolStrip.EndDrag イベント

メモ : このイベントは、.NET Framework version 2.0新しく追加されたものです。

ユーザーが ToolStrip コントロールドラッグ停止する発生します

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

解説解説
使用例使用例

ToolStrip および ToolStripContainer で、BeginDrag と EndDrag使用するコード例次に示します

Imports System
Imports System.Windows.Forms



Public Class Form1
   Inherits Form
   Private toolStripContainer1 As ToolStripContainer
   Private toolStrip1 As ToolStrip
   Private richTextBox1 As RichTextBox
   
   
   Public Sub New()
      DragToolStrip()
   End Sub
   
   <STAThread()>  _
   Shared Sub Main()
      Application.EnableVisualStyles()
      Application.Run(New Form1())
   End Sub
   
   
   Private Sub DragToolStrip()
      ' Create a ToolStripContainer.
      toolStripContainer1 = New System.Windows.Forms.ToolStripContainer()
      toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill
      Controls.Add(toolStripContainer1)
      
      ' Create a ToolStrip and add items to it.
      toolStrip1 = New System.Windows.Forms.ToolStrip()
      toolStrip1.Items.Add("One")
      toolStrip1.Items.Add("Two")
      toolStrip1.Items.Add("Three")
      
      ' Add the ToolStrip to the top panel of the ToolStripContainer.
      toolStripContainer1.TopToolStripPanel.Controls.Add(toolStrip1)
      
      ' Create a RichTextBox and add it to the ContentPanel.
      richTextBox1 = New System.Windows.Forms.RichTextBox()
      richTextBox1.Location = New System.Drawing.Point(94, 61)
      toolStripContainer1.ContentPanel.Controls.Add(richTextBox1)
      
      ' Attach event handlers for the BeginDrag and EndDrag events.
      AddHandler toolStrip1.BeginDrag, AddressOf
 toolStrip1_BeginDrag
      AddHandler toolStrip1.EndDrag, AddressOf
 toolStrip1_EndDrag
   End Sub
   
   ' Clear any text from the RichTextBox when a drag operation begins.
   Public Sub toolStrip1_BeginDrag(sender As
 Object, e As EventArgs)
      richTextBox1.Text = ""
   End Sub
   
   ' Notify the user when the drag operation ends.
   Public Sub toolStrip1_EndDrag(sender As
 Object, e As EventArgs)
      richTextBox1.Text = "The drag operation is complete."
   End Sub
End Class
using System;
using System.Windows.Forms;

public class Form1 : Form
{
    private ToolStripContainer toolStripContainer1;
    private ToolStrip toolStrip1;
    private RichTextBox richTextBox1;
 
    public Form1()
    {
        DragToolStrip();
    }
    [STAThread]
    static void Main()
        {
            Application.EnableVisualStyles();
            Application.Run(new Form1());
        }

        private void DragToolStrip()
        {
        // Create a ToolStripContainer.
        toolStripContainer1 = new System.Windows.Forms.ToolStripContainer();
        toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
        Controls.Add(toolStripContainer1);

        // Create a ToolStrip and add items to it.
        toolStrip1 = new System.Windows.Forms.ToolStrip();
        toolStrip1.Items.Add("One");
        toolStrip1.Items.Add("Two");
        toolStrip1.Items.Add("Three");
            
        // Add the ToolStrip to the top panel of the ToolStripContainer.
        toolStripContainer1.TopToolStripPanel.Controls.Add(toolStrip1);
            
        // Create a RichTextBox and add it to the ContentPanel.
        richTextBox1 = new System.Windows.Forms.RichTextBox();
        richTextBox1.Location = new System.Drawing.Point(94, 61);
        toolStripContainer1.ContentPanel.Controls.Add(richTextBox1);

        // Attach event handlers for the BeginDrag and EndDrag events.
        toolStrip1.BeginDrag += new System.EventHandler(toolStrip1_BeginDrag);
        toolStrip1.EndDrag += new System.EventHandler(toolStrip1_EndDrag);
    }
    // Clear any text from the RichTextBox when a drag operation begins.
    private void toolStrip1_BeginDrag(object
 sender, EventArgs e)
    {
        richTextBox1.Text = "";
    }
    // Notify the user when the drag operation ends.
    private void toolStrip1_EndDrag(object
 sender, EventArgs e)
    {
        richTextBox1.Text="The drag operation is complete.";
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

ToolStrip.EndDrag イベントのお隣キーワード
検索ランキング

   

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



ToolStrip.EndDrag イベントのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS