我的项目在.NET Frame 3.5中成功运行且没有错误.但是,当我将它定位到.NET Frame工作4.我得到了错误:
" 对PInvoke函数的调用使堆栈失衡.这可能是因为托管的PInvoke签名与非托管目标签名不匹配. "
我使用了非托管库,如下所示:
[StructLayout(LayoutKind.Sequential )]
public class DGNElemCore
{
public int offset;
public int size;
public int element_id;
public int stype;
public int level;
public int type;
public int complex;
public int deleted;
public int graphic_group;
public int properties;
public int color;
public int weight;
public int style;
public int attr_bytes;
public IntPtr attr_data;
public int raw_bytes;
public IntPtr raw_data;
}
[DllImport("DgnLib.dll", EntryPoint = "DGNOpen")]
public static extern IntPtr DGNOpen(string fileName, int bUpdate)
Run Code Online (Sandbox Code Playgroud)
你知道如何解决这个错误吗?
请参阅我的示例图表

现在,我想更改图例的文本(不显示百分比值)与系列数据的xValues相同,例如:伦敦,东京,巴黎......(仍然保留饼图中的百分比值).
你知道怎么做吗 ?
我使用以下代码:
int[] yValues = { 50, 20, 10, 20 };
string[] xValues = { "London", "Paris", "Newyork", "Tokyo"};
myChart.Series["Default"].Points.DataBindXY(xValues, yValues);
myChart.Series[0].Label = "#PERCENT{P2}";
Run Code Online (Sandbox Code Playgroud)