No more Death March

あるSEのチラシの裏 C# WPF

既定のプリンター名を取得する。

using System;
using System.Printing;

namespace DefaultPrinterName
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("既定のプリンタは{0}です。", LocalPrintServer.GetDefaultPrintQueue().FullName);

            Console.ReadKey();
        }
    }
}

system.printingを参照設定に追加
LocalPrintServerクラスのstaticメソッドGetDefaultPrintQueueでプリンタ設定のインスタンスを取得
FullNameプロパティでプリンタ名を取得