Bonjour
J'essaye sans succes l'operation suivante
Dans une classe je déclare un PrintDialog pd avec tout ce qui lui faut pour imprimer : document etc...
Ensuite je fais un pd.ShowDialog() pour le PrinterSetup
Je recupere unsuite ce PrinTerSetup
this.ptrSet = (PrinterSettings) pd.PrinterSettings.Clone();
Et puis j'imprime le document
Le coup d'apres
J'ouvre un AUTRE PrintDialog exterieur a ma classe en vue de modifier les parametres d"impression
1 2 3 4 5 6 7
| if (printer.ptrSet != null)
{
PrintDialog pd = new PrintDialog();
pd.ShowDialog();
printer.ptrSet = null;
printer.ptrSet = (PrinterSettings)pd.PrinterSettings.Clone();
} |
Tout va bien ce nouveau (PrinterSettings) contient bien ce que je lui ai demandé : changer nombre de page et couleur d'impression
Dans ma classe je reassigne le nouveau PrinterSettings au printdialog nouvellement créé
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| if (this.ptrSet != null)
{
pd.Reset();
pd.PrinterSettings = new PrinterSettings();
pd.PrinterSettings = this.ptrSet;
SetupPrint(pd);
printDoc.Print();
}
else if (DialogResult.OK == pd.ShowDialog())
{
SetupPrint(pd);
printDoc.Print();
this.ptrSet = (PrinterSettings) pd.PrinterSettings.Clone();
} |
Avec le DEBUG je verifie que le pd.PrinterSettings contient bien les seting demandé : OUI
Mais tout se passe avec les settings du premier coup comme si je n'avais rien changé ???
Partager