■95386 / ) |
Re[4]: Win-10/Pro + C# + IPAmj明朝 |
□投稿者/ 魔界の仮面弁士 (2789回)-(2020/07/27(Mon) 15:46:22)
|
■No95385 (S.Kos さん) に返信 > WPFなるシカケを探ってみました・・・なにやら(?)厄介そうですねぇ・・・
"PrintQueue.CreateXpsDocumentWriter" などで検索すると、印刷系のサンプルが見つかるかも。 WinForms との連携ではなく、WPF Application 向けの情報が殆どだとは思いますが。
もしも先のコードを Windows Forms アプリケーションから呼び出す場合は、下記が必要です。
// 追加するべき参照設定 PresentationFramework.dll PresentationCore.dll WindowsBase.dll System.Printing.dll
// 必要な名前空間 using System.Printing; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Media;
ただし、下記で示した名前空間の競合がありますので、 実際のコードでは名前空間を含めて指定するようにするか、 あるいは using で別名を付与しておくことが求められます。
> var printDialog = new PrintDialog(); System.Windows.Forms.PrintDialog クラスではなく System.Windows.Controls.PrintDialog クラスの方です。
> textBlock.FontFamily = new FontFamily("IPAmj明朝"); System.Drawing.FontFamily クラスではなく System.Windows.Media.FontFamily クラスの方です。
|
|