本文整理汇总了VB.NET中System.Windows.Forms.NativeWindow.CreateHandle方法的典型用法代码示例。如果您正苦于以下问题:VB.NET NativeWindow.CreateHandle方法的具体用法?VB.NET NativeWindow.CreateHandle怎么用?VB.NET NativeWindow.CreateHandle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.NativeWindow 的用法示例。
在下文中一共展示了NativeWindow.CreateHandle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: MyNativeWindow
' MyNativeWindow class to create a window given a class name.
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
Friend Class MyNativeWindow
Inherits NativeWindow
' Constant values were found in the "windows.h" header file.
Private Const WS_CHILD As Integer = &H40000000, _
WS_VISIBLE As Integer = &H10000000, _
WM_ACTIVATEAPP As Integer = &H1C
Private windowHandle As Integer
Public Sub New(ByVal parent As Form)
Dim cp As CreateParams = New CreateParams()
' Fill in the CreateParams details.
cp.Caption = "Click here"
cp.ClassName = "Button"
' Set the position on the form
cp.X = 100
cp.Y = 100
cp.Height = 100
cp.Width = 100
' Specify the form as the parent.
cp.Parent = parent.Handle
' Create as a child of the specified parent
cp.Style = WS_CHILD Or WS_VISIBLE
' Create the actual window
Me.CreateHandle(cp)
End Sub
' Listen to when the handle changes to keep the variable in sync
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
Protected Overrides Sub OnHandleChange()
windowHandle = Me.Handle.ToInt32()
End Sub
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
Protected Overrides Sub WndProc(ByRef m As Message)
' Listen for messages that are sent to the button window. Some messages are sent
' to the parent window instead of the button's window.
Select Case (m.Msg)
Case WM_ACTIVATEAPP
' Do something here in response to messages
End Select
MyBase.WndProc(m)
End Sub
End Class
开发者ID:VB.NET开发者,项目名称:System.Windows.Forms,代码行数:56,代码来源:NativeWindow.CreateHandle
注:本文中的System.Windows.Forms.NativeWindow.CreateHandle方法示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论