开发者

Dual printer managment from single application

How to manage more than one printer from single C# windows application? Requirement is there should be only one print button and it will give print command to printer as per 开发者_运维技巧configuration in application.


Easy enough to do. Project + Properties, Settings tab, add a setting named "Printer". Then use it like this:

    private void btnPrint_Click(object sender, EventArgs e) {
        printDocument1.PrinterSettings.PrinterName =
            Properties.Settings.Default.Printer;
        printDocument1.Print();
    }

Somebody with admin privileges will have to edit your app.exe.config file to set the printer name. Given how likely it is for the printer name to change, I would strongly recommend you make this a User scoped setting and add an Options + Select Printer menu command to allow the user to select the printer. Use PrintDialog.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜