【发布时间】:2014-06-05 01:31:48
【问题描述】:
我有一个简单的问题:
我必须在视觉 C++/CLR 项目中包含什么才能使用 Font^ ?
我试图创建一个 ref 类,如下所示:
[SerializableAttribute]
[ComVisibleAttribute(true)]
[TypeConverterAttribute(typeof(FontConverter))]
public ref class Font sealed : public MarshalByRefObject,
ICloneable, ISerializable, IDisposable
我正在做一个项目,如果我必须能够打印一些东西,所以我的编码非常类似于这样的东西: http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.print(v=vs.110).aspx?cs-save-lang=1&cs-lang=cpp
我尝试为Font^ 使用命名空间,如下所示:
using namespace System;
using namespace System::IO;
using namespace System::Drawing;
using namespace System::Drawing::Printing;
using namespace System::Windows::Forms;
或者我尝试使用 dll。文件以便能够使用 Font^ 作为变量(特别是 #using <System.Drawing.dll>
但似乎没有一个成功...
所以我需要使用Font^ 作为变量,如下所示:
Font^ printFont = new System.Drawing.Font("Arial", 10);
SolidBrush myBrush = new SolidBrush(Color.Black);
谁能提出一种允许使用 Font^ 的方法,因为在我的错误列表中它说 Font^ printFont 是未识别的。
附:我是c++初学者,真的不知道怎么用Font^作为变量
【问题讨论】: