Print を (プリンターに) 実装する方法を示す MonoMac サンプルを知っている人はいますか? 私はそれを見つけることができませんでした。
2 に答える
1
どれかはわかりませんが、Appleの概念ドキュメントは関連性があり、サンプルスニペットはC#に簡単に移植できるはずです:https ://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ Printing / Printing.html
于 2012-03-09T03:01:46.013 に答える
0
次のような PrintDocument クラスを作成しました: (適切なサイズを設定し、drawrect に描画を追加する必要があります)。
public class PrintDocument:NSView {
NSPrintOperation MyPrinter = null;
static IntPtr selCurrentContext = Selector.GetHandle ("currentContext");
static IntPtr classNSGraphicsContext = Class.GetHandle ("NSGraphicsContext");
public PrintDocument ()
{
MyPrinter=NSPrintOperation.FromView(this);
this.SetFrameSize(new SizeF(600,800));
}
public void Print ()
{
MyPrinter.RunOperation()
}
public override void DrawRect (RectangleF dirtyRect)
{
var context = new NSGraphicsContext (Messaging.IntPtr_objc_msgSend (classNSGraphicsContext, selCurrentContext));
//NSPrintOperation.CurrentOperation
}
}
于 2012-12-19T13:36:52.840 に答える