本文整理汇总了VB.NET中System.Windows.Forms.ToolStrip.BeginDrag事件的典型用法代码示例。如果您正苦于以下问题:VB.NET ToolStrip.BeginDrag事件的具体用法?VB.NET ToolStrip.BeginDrag怎么用?VB.NET ToolStrip.BeginDrag使用的例子?那么恭喜您, 这里精选的事件代码示例或许可以为您提供帮助。您也可以进一步了解该事件所在类System.Windows.Forms.ToolStrip 的用法示例。
在下文中一共展示了ToolStrip.BeginDrag事件的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: Form1
' 导入命名空间
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.
Private Sub toolStrip1_BeginDrag(sender As Object, e As EventArgs)
richTextBox1.Text = ""
End Sub
' Notify the user when the drag operation ends.
Private Sub toolStrip1_EndDrag(sender As Object, e As EventArgs)
richTextBox1.Text = "The drag operation is complete."
End Sub
End Class
开发者ID:VB.NET开发者,项目名称:System.Windows.Forms,代码行数:58,代码来源:ToolStrip.BeginDrag
注:本文中的System.Windows.Forms.ToolStrip.BeginDrag事件示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论