- visualframework_src.zip
- sample
- CNN
- cls.cls
- MSSCCPRJ.SCC
- PrjCnn.dll
- PrjCnn.exp
- PrjCnn.lib
- PrjCnn.vbp
- PrjCnn.vbw
- DemoDoc
- MfcViewLib
- ObjManager
- VbComLib
- VBDoc
- MSSCCPRJ.SCC
- prjVBDoc.vbp
- prjVBDoc.vbw
- UD.dob
- VCSharpComLib
- VisualFrameWork
|
Imports System.Runtime.InteropServices
' ����һ���µĴ�����
<ComVisible(False)> _
Public Delegate Sub VbObjEventHandler()
' �¼�Դ�ӿ�
<Guid(VbObj.EventsId), _
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)> _
Public Interface IVbObjEvent
' ����һ���¼�Դ
Sub NewEvent()
End Interface
<ClassInterface(ClassInterfaceType.AutoDual), _
Guid(VbObj.ClassId), _
ComSourceInterfaces(GetType(IVbObjEvent))> _
Public Class VbObj
Inherits System.Windows.Forms.UserControl
#Region "COM GUIDs"
' ��Щ GUID �ṩ����� COM ��ʶ���� COM �ӿڡ�
' ������������ǣ����еĿͻ��˽���Ҳ��
' ���ʸ��ࡣ
Public Const ClassId As String = "31BE0C05-9A8F-4F09-9592-CAC6B6F4989E"
Public Const InterfaceId As String = "ECFEFDA7-F1E6-4963-A2EB-552AD45ECE2D"
Public Const EventsId As String = "9AAA2E5B-E19E-4373-8EAF-1C25D8074C66"
#End Region
#Region " Windows ������������ɵĴ��� "
Public Sub New()
MyBase.New()
'�õ����� Windows ���������������ġ�
InitializeComponent()
'�� InitializeComponent() ����֮������κγ�ʼ��
End Sub
'UserControl ��д dispose ����������б��
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows ����������������
Private components As System.ComponentModel.IContainer
'ע�⣺���¹����� Windows ����������������
'����ʹ�� Windows ����������Ĵ˹��̡�
'��Ҫʹ�ô���༭��������
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'Button1
'
Me.Button1.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(128, Byte), CType(128, Byte))
Me.Button1.Location = New System.Drawing.Point(32, 72)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(80, 32)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
'
'VbObj
'
Me.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(255, Byte), CType(128, Byte))
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1})
Me.Name = "VbObj"
Me.ResumeLayout(False)
End Sub
#End Region
' ����һ���¼�
Public Event NewEvent As VbObjEventHandler
' ����һ������
Public Sub NewMethod()
' �����¼�
RaiseEvent NewEvent()
End Sub
' ��̬����.Net���
Public Sub LoadDotNetControl(ByVal sLibraryName As String, ByVal sControlName As String, ByVal sName As String)
Dim mAssembly As System.Reflection.Assembly
Dim mType As Type
Dim mDynObj As Object
Dim mPropertyInfo As System.Reflection.PropertyInfo
' �������
mAssembly = System.Reflection.Assembly.Load(sLibraryName)
' �õ��������
mType = mAssembly.GetType(sLibraryName + "." + sControlName, True, True)
' �����齨�ӿ�
mDynObj = System.Activator.CreateInstance(mType)
' �������Dock����
mPropertyInfo = mType.GetProperty("Dock")
mPropertyInfo.SetValue(mDynObj, System.Windows.Forms.DockStyle.Fill, Nothing)
' �������Name����
mPropertyInfo = mType.GetProperty("Name")
mPropertyInfo.SetValue(mDynObj, sName, Nothing)
' �ڵ�ǰ��������ʾ���
Controls.AddRange(New System.Windows.Forms.Control() {mDynObj})
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox("I'm a component created by vb.net")
End Sub
Friend WithEvents Button1 As System.Windows.Forms.Button
Private Sub VbObj_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.