2012-03-07 5 views
1

Print(プリンタ)を実装する方法を示すMonoMacのサンプルを知っている人はいますか?私は1つを見つけることができませんでした。MonoMacのサンプルを印刷

答えて

1

私は1つのか分からないが、Appleからの概念的なドキュメントが関連している、そしてそのサンプルスニペットは、C#にポートに簡単です:https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Printing/Printing.html

+0

はい、私は多種多様なCocoa印刷ドキュメントを読み、いくつかのObjective-C OS Xの書籍を印刷しています。よく現在のMonoMacにはNSViewの印刷を妨げるものがありません。 – djunod

+0

欠けているものは何ですか?私はあなたにバグを提出することをお勧めします... –

+0

Printing&Paginationメソッドについては、NSViewのリファレンスを参照してください。 MonoMacのバグはどこにありますか? – djunod

0

私は少し、このようなのPrintDocumentクラスを作成しました: (

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 
    } 

}