C#调用VB写DLL时出错
C:\Documents and Settings\All Users\Documents\My Pictures\示例图片用VB写了一个DLL用于向WORD 文档中插入平面坐标
在C# 中调用他
'画坐标
'(x1,y1)是原点坐标
'
Public Function DrawAxies_1(ByVal x1 As Double, ByVal y1 As Double, ByVal LenX As Double, ByVal LenY As Double) As Object
Dim mylabel As Shape
Dim L As Double
Dim i As Short
Dim K As Short
DialogDisplay = False
If (x1 - LenX / 2) < 0 Or (x1 + LenX / 2) > 1000 Or (y1 - LenY / 2) < 0 Or (y1 + LenY / 2) > 1000 Then
MsgBox("超出了绘图区域!请重新输入绘制参数", MsgBoxStyle.Exclamation, "提示")
DialogDisplay = True
DrawAxies_1 = Nothing
Exit Function
End If
oWord.ActiveDocument.Shapes.AddLine(x1 - LenX / 2, y1, x1 + LenX / 2, y1).Name = "shp1"
oWord.ActiveDocument.Shapes("shap1").Line.EndArrowheadStyle = MsoArrowheadStyle.msoArrowheadTriangle
oWord.ActiveDocument.Shapes.AddLine(x1, y1 - LenY / 2, x1, y1 + LenY / 2).Name = "shp2"
oWord.ActiveDocument.Shapes("shp2").Line.BeginArrowheadStyle = MsoArrowheadStyle.msoArrowheadTriangle
i = 1
K = 1
L = x1 + i * 10
While L <= x1 + LenX / 2 - 10
oWord.ActiveDocument.Shapes.AddLine(L, y1 - 3, L, y1).Name = "shp" & CStr(i + 2)
i = i + 1
K = K + 1
L = x1 + K * 10
End While
K = 1
L = x1 - K * 10
While L >= x1 - LenX / 2 + 2
oWord.ActiveDocument.Shapes.AddLine(L, y1 - 3, L, y1).Name = "shp" & CStr(i + 2)
i = i + 1
K = K + 1
L = x1 - K * 10
End While
K = 1
L = y1 - K * 10
While L >= y1 - LenY / 2 + 10
oWord.ActiveDocument.Shapes.AddLine(x1, L, x1 + 3, L).Name = "shp" & CStr(i + 2)
i = i + 1
K = K + 1
L = y1 - K * 10
End While
K = 1
L = y1 + K * 10
While L <= y1 + LenY / 2 - 2
oWord.ActiveDocument.Shapes.AddLine(x1, L, x1 + 3, L).Name = "shp" & CStr(i + 2)
i = i + 1
K = K + 1
L = y1 + K * 10
End While
mylabel = oWord.ActiveDocument.Shapes.AddTextEffect(MsoPresetTextEffect.msoTextEffect1, "x", "宋体", 6, MsoTriState.msoFalse, MsoTriState.msoFalse, x1 + LenX / 2, y1 + 2)
With mylabel
.Name = "shp" & CStr(i + 2)
End With
i = i + 1
mylabel = oWord.ActiveDocument.Shapes.AddTextEffect(MsoPresetTextEffect.msoTextEffect1, "y", "宋体", 6, MsoTriState.msoFalse, MsoTriState.msoFalse, x1 - 5, y1 - LenY / 2)
With mylabel
.Name = "shp" & CStr(i + 2)
End With
Dim J As Short
Dim Myshape(i + 2) As Object
For J = 0 To i + 1
Myshape(J) = "shp" & CStr(J)
Next
DrawAxies_1 = oWord.ActiveDocument.Shapes.Range(Myshape).Group
DrawFlag = True
End Function
在调用是出错
[img=C:\Documents and Settings\All Users\Documents\My Pictures\示例图片][/img] --------------------编程问答-------------------- C:\Documents and Settings\All Users\Documents\My Pictures\示例图片
没有看到 --------------------编程问答--------------------
我是楼主补充以下:
错误为:
未能加载程序集”OFFICE ,VERSION=12.0.0.0,CULTURE=NEUTRAL,PUBLICKEYTOKEN=71E9BCE11EP429C’或他的某一个以来想。系统找不到指定的文件。 --------------------编程问答-------------------- 是PublicKeyToken=71e9bce11e9429c
补充:.NET技术 , VB.NET