Imports System.Runtime.InteropServices
Public Class Form1
    REM Private Declare Sub CreateChart Lib "CChartu.dll" Alias "?CreateChart@Classless@@YAXXZ" ()
    REM Private Declare Function Attach Lib "CChartu.dll" Alias "?Attach@Classless@@YAHPAUHWND__@@@Z" (ByVal hWnd As IntPtr) As Integer
    REM Private Declare Sub ReDraw Lib "CChartu.dll" Alias "?ReDraw@Classless@@YAXXZ" ()
    REM Private Declare Function AddPoint2D Lib "CChartu.dll" Alias "?AddPoint2D@Classless@@YAHNNHH@Z" (ByVal x As Double, ByVal y As Double, ByVal DataIndex As Integer, ByVal PlotIndex As Integer) As Integer
    REM Private Declare Sub SetTitle Lib "CChartu.dll" Alias "?SetTitle@Classless@@YAXPB_W@Z" (ByVal title As String)

    <DllImport("CChartu.dll", EntryPoint:="?CreateChart@Classless@@YAXXZ", CallingConvention:=System.Runtime.InteropServices.CallingConvention.Cdecl)>
    Public Shared Sub CreateChart()
    End Sub
    <DllImport("CChartu.dll", EntryPoint:="?Attach@Classless@@YAHPAUHWND__@@@Z", CallingConvention:=System.Runtime.InteropServices.CallingConvention.Cdecl)>
    Public Shared Function Attach(ByVal hWnd As IntPtr) As Integer
    End Function
    <DllImport("CChartu.dll", EntryPoint:="?ReDraw@Classless@@YAXXZ", CallingConvention:=System.Runtime.InteropServices.CallingConvention.Cdecl)>
    Public Shared Sub ReDraw()
    End Sub
    <DllImport("CChartu.dll", EntryPoint:="?AddPoint2D@Classless@@YAHNNHH@Z", CallingConvention:=System.Runtime.InteropServices.CallingConvention.Cdecl)>
    Public Shared Function AddPoint2D(ByVal x As Double, ByVal y As Double, ByVal DataIndex As Integer, ByVal PlotIndex As Integer) As Integer
    End Function
    <DllImport("CChartu.dll", EntryPoint:="?SetTitle@Classless@@YAXPB_W@Z", CallingConvention:=System.Runtime.InteropServices.CallingConvention.Cdecl)>
    Public Shared Sub SetTitle(ByVal title() As Byte)
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim mHandle As IntPtr = Me.Handle()
        CreateChart()
        Attach(mHandle)

        For i As Integer = -10 To 10
            AddPoint2D(i, i * i, 0, 0)
        Next

        Dim title() As Byte = System.Text.Encoding.Unicode.GetBytes("VB.Net测试")
        SetTitle(title)
    End Sub

    Private Sub Form1_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Resize
        ReDraw()
    End Sub
End Class
