Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/257.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/142.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 有没有办法将C++ GDI+笔转换成C笔 在C++项目中,我创建了一个GDI+笔。C++代码示例: long GetPen() { Pen *pen = new Pen(Color.Red); return (long)pen; } 在C项目_C#_C++_Gdi+ - Fatal编程技术网

C# 有没有办法将C++ GDI+笔转换成C笔 在C++项目中,我创建了一个GDI+笔。C++代码示例: long GetPen() { Pen *pen = new Pen(Color.Red); return (long)pen; } 在C项目

C# 有没有办法将C++ GDI+笔转换成C笔 在C++项目中,我创建了一个GDI+笔。C++代码示例: long GetPen() { Pen *pen = new Pen(Color.Red); return (long)pen; } 在C项目,c#,c++,gdi+,C#,C++,Gdi+,有没有办法将C++ GDI+笔转换成C笔 在C++项目中,我创建了一个GDI+笔。C++代码示例: long GetPen() { Pen *pen = new Pen(Color.Red); return (long)pen; } 在C项目中,我想使用C++项目的GDI+PEN创建。C代码示例: [DllImport("xxxx.dll")] public static extern IntPtr GetPen(); public void test() { Intptr

有没有办法将C++ GDI+笔转换成C笔 <>在C++项目中,我创建了一个GDI+笔。C++代码示例:

long GetPen()
{
  Pen *pen = new Pen(Color.Red);

  return (long)pen; 
}
在C项目中,我想使用C++项目的GDI+PEN创建。C代码示例:

[DllImport("xxxx.dll")]
public static extern IntPtr GetPen();

public void test()
{
   Intptr penptr = GetPen();

   //i want to convert the penptr to C# pen,is there any way?
}

,以及System.Drawing命名空间中的类。为什么需要这样做?是的!GDI+笔只能由C++在项目中创建。项目是关于读取EMF文件的。我只能使用C++来获取EMF文件的每一个元素。我认为Pink类不能提供这样的互操作机制…如果你绝对要使用C++中的非托管笔,你可能需要对GDI+进行调用/调用,并且还要注意,基于你的代码,你需要调用C++代码来删除非托管笔。