本文整理汇总了VB.NET中System.Windows.Forms.Cursor类的典型用法代码示例。如果您正苦于以下问题:VB.NET Cursor类的具体用法?VB.NET Cursor怎么用?VB.NET Cursor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Cursor类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: Main
' 导入命名空间
Imports System.Drawing
Imports System.Windows.Forms
Namespace CustomCursor
Public Class Form1
Inherits System.Windows.Forms.Form
<System.STAThread()> _
Public Shared Sub Main()
System.Windows.Forms.Application.Run(New Form1())
End Sub
Public Sub New()
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Text = "Cursor Example"
' The following generates a cursor from an embedded resource.
'To add a custom cursor, create a bitmap
' 1. Add a new cursor file to your project:
' Project->Add New Item->General->Cursor File
'--- To make the custom cursor an embedded resource ---
'In Visual Studio:
' 1. Select the cursor file in the Solution Explorer
' 2. Choose View->Properties.
' 3. In the properties window switch "Build Action" to "Embedded Resources"
'On the command line:
' Add the following flag:
' /res:CursorFileName.cur,Namespace.CursorFileName.cur
' Where "Namespace" is the namespace in which you want to use the cursor
' and "CursorFileName.cur" is the cursor filename.
'The following line uses the namespace from the passed-in type
'and looks for CustomCursor.MyCursor.cur in the assemblies manifest.
'NOTE: The cursor name is acase sensitive.
Me.Cursor = New Cursor(Me.GetType(), "MyCursor.cur")
End Sub
End Class
End Namespace 'CustomCursor
开发者ID:VB.NET开发者,项目名称:System.Windows.Forms,代码行数:46,代码来源:Cursor
示例2: Customer
Public Class Customer
Inherits [Object]
Private custName As String = ""
Friend custOrders As New ArrayList()
Public Sub New(ByVal customername As String)
Me.custName = customername
End Sub
Public Property CustomerName() As String
Get
Return Me.custName
End Get
Set(ByVal Value As String)
Me.custName = Value
End Set
End Property
Public ReadOnly Property CustomerOrders() As ArrayList
Get
Return Me.custOrders
End Get
End Property
End Class
Public Class Order
Inherits [Object]
Private ordID As String
Public Sub New(ByVal orderid As String)
Me.ordID = orderid
End Sub
Public Property OrderID() As String
Get
Return Me.ordID
End Get
Set(ByVal Value As String)
Me.ordID = Value
End Set
End Property
End Class
' Create a new ArrayList to hold the Customer objects.
Private customerArray As New ArrayList()
Private Sub FillMyTreeView()
' Add customers to the ArrayList of Customer objects.
Dim x As Integer
For x = 0 To 999
customerArray.Add(New Customer("Customer" + x.ToString()))
Next x
' Add orders to each Customer object in the ArrayList.
Dim customer1 As Customer
For Each customer1 In customerArray
Dim y As Integer
For y = 0 To 14
customer1.CustomerOrders.Add(New Order("Order" + y.ToString()))
Next y
Next customer1
' Display a wait cursor while the TreeNodes are being created.
Cursor.Current = New Cursor("MyWait.cur")
' Suppress repainting the TreeView until all the objects have been created.
treeView1.BeginUpdate()
' Clear the TreeView each time the method is called.
treeView1.Nodes.Clear()
' Add a root TreeNode for each Customer object in the ArrayList.
Dim customer2 As Customer
For Each customer2 In customerArray
treeView1.Nodes.Add(New TreeNode(customer2.CustomerName))
' Add a child TreeNode for each Order object in the current Customer object.
Dim order1 As Order
For Each order1 In customer2.CustomerOrders
treeView1.Nodes(customerArray.IndexOf(customer2)).Nodes.Add( _
New TreeNode(customer2.CustomerName + "." + order1.OrderID))
Next order1
Next customer2
' Reset the cursor to the default for all controls.
Cursor.Current = System.Windows.Forms.Cursors.Default
' Begin repainting the TreeView.
treeView1.EndUpdate()
End Sub
开发者ID:VB.NET开发者,项目名称:System.Windows.Forms,代码行数:91,代码来源:Cursor
注:本文中的System.Windows.Forms.Cursor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论