IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C# Discussion :

impression et apercu


Sujet :

C#

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Février 2012
    Messages
    6
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2012
    Messages : 6
    Par défaut impression et apercu
    Bonsoir,

    Je faits un logiciel de dessin et je veux avoir un apercu avant impression ceci en paysage et où ma zone dessin remplit entierement l apercu voila!!

    si les bonnes âmes peuvent m aider??

    Merci!

    je donne le bout de code que j ai essayé de faire aboutir


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
     
           private void aperçuavantimpressionToolStripMenuItem_Click(object sender, EventArgs e)
            {
                    PrintPreviewDialog ppd = new PrintPreviewDialog();
     
            //Set the size, location, and name.
            ppd.ClientSize =
                new System.Drawing.Size(400, 300);
            ppd.Location =
                new System.Drawing.Point(29, 29);
            ppd.Name = "PrintPreviewDialog1";
     
            // Associate the event-handling method with the 
            // document's PrintPage event.
            this.document.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(printDocument1_PrintPage);
     
            // Set the minimum size the dialog can be resized to.
            ppd.MinimumSize =
                new System.Drawing.Size(375, 250);
     
            // Set the UseAntiAlias property to true, which will allow the 
            // operating system to smooth fonts.
            ppd.UseAntiAlias = true;
            ppd.Document = document;
            ppd.Document.DefaultPageSettings.Landscape = true; 
     
            ppd.ShowDialog();
            }
     
            private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
            {
                Bitmap impr = new Bitmap(panel1.Width, panel1.Height);
                panel1.DrawToBitmap(impr, panel1.ClientRectangle);
     
                float f2 = (float)e.MarginBounds.Height / (float)impr.Height; 
                float f1 = (float)e.MarginBounds.Width / (float)impr.Width;
                e.Graphics.ScaleTransform(f1, f2);
     
                e.Graphics.DrawImage(impr, 0, 0);
     
                /*			Bitmap impr = new Bitmap(panel1.Width, panel1.Height);
    			panel1.DrawToBitmap(impr, panel1.ClientRectangle);
     
    			float factech = Math.Min(((float)e.MarginBounds.Height / (float)impr.Height), ((float)e.MarginBounds.Width / (float)impr.Width));
    			e.Graphics.ScaleTransform(factech, factech);
     
    			e.Graphics.DrawImage(impr, 0 , 0);
                 * */
            }

  2. #2
    Expert confirmé Avatar de Graffito
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    5 993
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 5 993
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    ppd.Document = document;
    if (ppd.ShowDialog() == DialogResult.OK) ppd.Document.Print();
    PrintFile_Click is called from the Print Menu. This routine first assigns the PrintDialog component to the document being printed. The dialog is shown using ShowDialog so the user can set their print settings and to decide whether to print or not.

  3. #3
    Membre du Club
    Profil pro
    Inscrit en
    Février 2012
    Messages
    6
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2012
    Messages : 6
    Par défaut
    le probleme n est pas la...

Discussions similaires

  1. [Débutant] Impression sans apercu
    Par kruger54 dans le forum VB.NET
    Réponses: 0
    Dernier message: 29/03/2015, 12h09
  2. creer un apercu avant impression d'un StringGrid
    Par blondelle dans le forum C++Builder
    Réponses: 28
    Dernier message: 09/08/2006, 22h57
  3. Problème entre "apercu avant impression" et "impression"
    Par mariemor64 dans le forum Général JavaScript
    Réponses: 3
    Dernier message: 18/07/2006, 11h57
  4. [VB.NET] code pour afficher apercu avant impression
    Par DonJR dans le forum Windows Forms
    Réponses: 1
    Dernier message: 14/07/2006, 20h54
  5. modifier apercu impression cview
    Par tyarcaouen dans le forum MFC
    Réponses: 2
    Dernier message: 17/10/2005, 09h30

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo