using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Drawing.Printing;
public class frmMain : System.Windows.Forms.Form {
public frmMain() {
this.Paint += new System.Windows.Forms.PaintEventHandler(this.frmMain_Paint);
}
[STAThread]
static void Main() {
Application.Run(new frmMain());
}
private void frmMain_Paint(object sender, System.Windows.Forms.PaintEventArgs e) {
PrinterSettings pSettings = new PrinterSettings();
Font printFont = new Font("Arial", 10);
int nTextPosY = 0;
int nTextPosX = 5;
int nHeight = (int)printFont.GetHeight(e.Graphics);
foreach (string sPtr in PrinterSettings.InstalledPrinters) {
pSettings.PrinterName = "BadName";
e.Graphics.DrawString(sPtr, printFont, Brushes.Black, nTextPosX, nTextPosY + 5);
e.Graphics.DrawString("Can Duplex: " + pSettings.CanDuplex.ToString(),
printFont, Brushes.Black, nTextPosX + 10, nTextPosY + (5 + nHeight));
e.Graphics.DrawString("Is Default: " + pSettings.IsDefaultPrinter.ToString(),
printFont, Brushes.Black, nTextPosX + 10, nTextPosY + (5 + nHeight * 2));
e.Graphics.DrawString("Is Plotter: " + pSettings.IsPlotter.ToString(),
printFont, Brushes.Black, nTextPosX + 10, nTextPosY + (5 + nHeight * 3));
e.Graphics.DrawString("Landscape Angle: " + pSettings.LandscapeAngle.ToString(),
printFont, Brushes.Black, nTextPosX + 10, nTextPosY + (5 + nHeight * 4));
e.Graphics.DrawString("Maximum Copies: " + pSettings.MaximumCopies.ToString(),
printFont, Brushes.Black, nTextPosX + 10, nTextPosY + (5 + nHeight * 5));
e.Graphics.DrawString("Maximum Page: " + pSettings.MaximumPage.ToString(),
printFont, Brushes.Black, nTextPosX + 10, nTextPosY + (5 + nHeight * 6));
e.Graphics.DrawString("Minimum Page: " + pSettings.MinimumPage.ToString(),
printFont, Brushes.Black, nTextPosX + 10, nTextPosY + (5 + nHeight * 7));
e.Graphics.DrawString("Supports Color: " + pSettings.SupportsColor.ToString(),
printFont, Brushes.Black, nTextPosX + 10, nTextPosY + (5 + nHeight * 8));
nTextPosY = nTextPosY + ((5 + nHeight * 8) + nHeight);
}
return;
}
}
|