DPI Graphiques de Résolution d'Écran de Pixels WinForm PrintPageEventArgs

Comment Dpi Points concernent Pixels pour afficher ma demande est en cours d'exécution sur?

int points;
Screen primary;

public Form1() {
  InitializeComponent();
  points = -1;
  primary = null;
}

void OnPaint(object sender, PaintEventArgs e) {
  if (points < 0) {
    points = (int)(e.Graphics.DpiX / 72.0F); //There are 72 points per inch
  }
  if (primary == null) {
    primary = Screen.PrimaryScreen;
    Console.WriteLine(primary.WorkingArea.Height);
    Console.WriteLine(primary.WorkingArea.Width);
    Console.WriteLine(primary.BitsPerPixel);
  }
}

Faire, j'ai maintenant toutes les informations dont j'ai besoin?

Puis-je utiliser l'une des informations ci-dessus pour savoir de combien de temps 1200 pixels est?

Remarque: une Fois que j'apprends comment faire pour afficher mon Formulaire universellement, les données sur ce formulaire sera envoyé à une imprimante, d'où le PrintPageEventArgs dans le titre.

OriginalL'auteur jp2code | 2011-02-25