有一个用vc++写的显示地图的ocx控件,其中显示点的函数声明如下,
void CMapCtrl::DrawKeyPoint(long PointID, short Symbol, BSTR FAR* szName, BSTR FAR* Point, short Size, long dwColor) 
{
    PPOINTEX pp = (PPOINTEX)Point;
},其中//PPOINTEX为一自定义结构体,szName为一字符串。我将这个ocx控件,拖放到vs2005 C#中,其中的DrawKeyPoint的声明变为如下:
public virtual void DrawKeyPoint(int pointID, short symbol, ref string szName, ref string point, short size, int dwColor)现在的问题是,在C#中,这个ref string point如何值。

解决方案 »

  1.   

                string szName, point;
                szName = point = string.Empty;
                DrawKeyPoint(int pointID, short symbol, ref string szName, ref string point, short size, int dwColor) 
      

  2.   

    ref 关键字使参数按引用传递
    但参数在传入函数体之前需要先初始化.
      

  3.   

    BSTR FAR* Point是要传进去的参数。而且是一个结构体,这样直接用string应该是不行的。
      

  4.   

    你自己根据 C++中PPOINTEX的结构定义个结构体,然后ref string point改成ref PPOINTEX point 试试看行不行啊
      

  5.   

    BSTR* szName,point都是传入参数。
    将ocx导入工程后变为了
    DrawKeyPoint(int pointID, short symbol, ref string szName, ref string point, short size, int dwColor)。
    结构体怎么的string进行转换?