本文整理汇总了VB.NET中System.Windows.Forms.ToolStripControlHost类的典型用法代码示例。如果您正苦于以下问题:VB.NET ToolStripControlHost类的具体用法?VB.NET ToolStripControlHost怎么用?VB.NET ToolStripControlHost使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ToolStripControlHost类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: ToolStripMonthCalendar
'Declare a class that inherits from ToolStripControlHost.
Public Class ToolStripMonthCalendar
Inherits ToolStripControlHost
' Call the base constructor passing in a MonthCalendar instance.
Public Sub New()
MyBase.New(New MonthCalendar())
End Sub
Public ReadOnly Property MonthCalendarControl() As MonthCalendar
Get
Return CType(Control, MonthCalendar)
End Get
End Property
' Expose the MonthCalendar.FirstDayOfWeek as a property.
Public Property FirstDayOfWeek() As Day
Get
Return MonthCalendarControl.FirstDayOfWeek
End Get
Set
MonthCalendarControl.FirstDayOfWeek = value
End Set
End Property
' Expose the AddBoldedDate method.
Public Sub AddBoldedDate(ByVal dateToBold As DateTime)
MonthCalendarControl.AddBoldedDate(dateToBold)
End Sub
' Subscribe and unsubscribe the control events you wish to expose.
Protected Overrides Sub OnSubscribeControlEvents(ByVal c As Control)
' Call the base so the base events are connected.
MyBase.OnSubscribeControlEvents(c)
' Cast the control to a MonthCalendar control.
Dim monthCalendarControl As MonthCalendar = _
CType(c, MonthCalendar)
' Add the event.
AddHandler monthCalendarControl.DateChanged, _
AddressOf HandleDateChanged
End Sub
Protected Overrides Sub OnUnsubscribeControlEvents(ByVal c As Control)
' Call the base method so the basic events are unsubscribed.
MyBase.OnUnsubscribeControlEvents(c)
' Cast the control to a MonthCalendar control.
Dim monthCalendarControl As MonthCalendar = _
CType(c, MonthCalendar)
' Remove the event.
RemoveHandler monthCalendarControl.DateChanged, _
AddressOf HandleDateChanged
End Sub
' Declare the DateChanged event.
Public Event DateChanged As DateRangeEventHandler
' Raise the DateChanged event.
Private Sub HandleDateChanged(ByVal sender As Object, _
ByVal e As DateRangeEventArgs)
RaiseEvent DateChanged(Me, e)
End Sub
End Class