Accueil > Forum > > > > pagesetup
pagesetup
dimanche 6 janvier 2008 à 19:31:51 |
pagesetup

DanMor498
|
quelqu'un peut me dir pourquoi ca fonctionne pas ce code Habituellement lorsque que je clique pageset cela doit fonction ouvrir la boite de dialog de printsetupdialog et dans la liste source devrait indiquer soit automatique ou autre source mais la rien et ca plante quand je ouvre propritées de limprimant et tout sort d'indication d erreur apparait et la boite de dialog printpreview vien folle et apparait de travers la boite de texte est tout defaites.  ------------------------------------------------------------------------------------------------- Imports System.Drawing.Printing PublicClass Form1 PrivateSub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load RichTextBox1.Text = "Programmers have undergone a major change in many years of programming various machines. For example, what could take days to create an " & _ "application in other programming languages like C, C++ could be done in hours with " & _ "Visual Basic. Visual Basic provides many interesting sets of tools to aid us in " & _ "building exciting applications. Visual Basic provides these tools to make our " & _ "life far more easier because all the real hard code is already written for us." 'filling the richtextbox with some text that can be used readily EndSub
PrivateSub PrintToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintToolStripMenuItem.Click If PrintDialog1.ShowDialog = DialogResult.OK Then 'showDialog method makes the dialog box visible at run time PrintDocument1.Print() EndIf EndSubPrivateSub PrintPreviewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintPreviewToolStripMenuItem.Click Try PrintPreviewDialog1.ShowDialog() Catch es As Exception MessageBox.Show(es.Message) EndTry EndSubPrivateSub PageSetupToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PageSetupToolStripMenuItem.Click With PageSetupDialog1 .PageSettings = PrintDocument1.DefaultPageSettings EndWith Try If PageSetupDialog1.ShowDialog = DialogResult.OK Then PrintDocument1.DefaultPageSettings = PageSetupDialog1.PageSettings EndIf Catch es As Exception messageBox.Show(es.Message) EndTry EndSubPrivateSub PPControlToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PPControlToolStripMenuItem.Click Try PrintPreviewControl1.Document = PrintDocument1 Catch es As Exception MessageBox.Show(es.Message) EndTry EndSubPrivateSub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage 'PrintPage is the foundational printing event. This event gets fired for every ' page that will be printed Static intCurrentChar As Int32' declaring a static variable to hold the position of the last printed char Dim font AsNew Font("Verdana", 14)' initializing the font to be used for printing Dim PrintAreaHeight, PrintAreaWidth, marginLeft, marginTop As Int32 With PrintDocument1.DefaultPageSettings' initializing local variables that contain the bounds of the printing area rectangle PrintAreaHeight = .PaperSize.Height - .Margins.Top - .Margins.Bottom PrintAreaWidth = .PaperSize.Width - .Margins.Left - .Margins.Right' initializing local variables to hold margin values that will serve ' as the X and Y coordinates for the upper left corner of the printing ' area rectangle.marginLeft = .Margins.Left marginTop = .Margins.Top ' X and Y coordinate EndWith If PrintDocument1.DefaultPageSettings.Landscape Then Dim intTemp As Int32 intTemp = PrintAreaHeight PrintAreaHeight = PrintAreaWidth PrintAreaWidth = intTemp
' if the user selects landscape mode, swap the printing area height and width EndIf Dim intLineCount As Int32 = CInt(PrintAreaHeight / font.Height) ' calculating the total number of lines in the document based on the height of ' the printing area and the height of the font Dim rectPrintingArea AsNew RectangleF(marginLeft, marginTop, PrintAreaWidth, PrintAreaHeight)' initializing the rectangle structure that defines the printing area Dim fmt AsNew StringFormat(StringFormatFlags.LineLimit)'instantiating the StringFormat class, which encapsulates text layout information Dim intLinesFilled, intCharsFitted As Int32 e.Graphics.MeasureString(Mid(RichTextBox1.Text, intCurrentChar + 1), font, New SizeF(PrintAreaWidth, PrintAreaHeight), fmt, intCharsFitted, intLinesFilled)' calling MeasureString to determine the number of characters that will fit in ' the printing area rectangle e.Graphics.DrawString(Mid(RichTextBox1.Text, intCurrentChar + 1), font, Brushes.Black, rectPrintingArea, fmt)' print the text to the page intCurrentChar += intCharsFitted'advancing the current char to the last char printed on this page '> TextBox1.Text.Length If intCurrentChar.ToString(e.HasMorePages = True) Then 'HasMorePages tells the printing module whether another PrintPage event should be fired Else e.HasMorePages = False intCurrentChar = 0 EndIf EndSub------------------------------------------------------------------------------------------------- DanMor 
|
|
Cette discussion est classée dans : system, to, of, byval, printing
Répondre à ce message
Sujets en rapport avec ce message
Obtain specifics System Informations [ par 25230 ]
Hello,On W2000 Workstation, I use "msinfo32.exe" to outputs System Information in a text format file (with option/report). The file result is very big
Je ne comprend pas cette erreur [ par Rouk ]
Bonjour,je developpe en vb.net et voici mon erreur :An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in system.windows.for
high speed bit transfer on usb [ par balek84 ]
Hi,I just want to know if i will have some problems with my usb interface. I want to put on usb 4 serial data of 24bits (96bits), 2 serial data of 12b
JavaScript vers VB [ par marinmarais ]
Bonjour à tous,Permettez-moi de vous présenter mon problème :J'ai récupéré un code source (dans le domaine public ;-) ) en Javascript permettant de c
printpreviewdialog[vbnet] [ par stargates ]
Bonjour,Lorsque j'affiche mon printpreviewdialog,celui se met derrière la form d'ou je l'ai appelécode pour la afficher la form Private <FON
Jbus et vb.net [ par fcampagne ]
Bonjour a tous, Alors voila mon probléme: je voudrais pouvoir envoyer et recevoir des trames via le port série de ma machine pour controler un apparei
Calendrie [ par asmaa17 ]
Salut à tout,je suis entraint de creer une calandrie,mais j'ai trouve des probléme.je veux quand je sélectionne un mois ,le programme affiche le calen
probleme de declaration de list of string [ par niko14 ]
Salut tout le monde!voila je voudrais intégrer dans un projet existant des trucs que j'ai fait moi a part!la première chose c'est que je voudrais décl
transformation of picture [ par beebrs ]
hello -i need to reduce the size of a picture using a VB script without loosing the quality of this picture-how can i integrate photo_ editor with th
Livres en rapport
|
Derniers Blogs
XNA IS DEAD!XNA IS DEAD! par richardc
Depuis la semaine dernière (et grâce aux TechDays 2012), je me penche activement sur la nouvelle version de Windows, aka Windows 8. Vous me direz, il était temps puisque la première preview date de Septembre dernier.
OK. Remarquez, on n'en est qu'aux...
Cliquez pour lire la suite de l'article par richardc TECHDAYS PARIS 2012 : WINDOWS SERVER "8" QUOI DE 9 !TECHDAYS PARIS 2012 : WINDOWS SERVER "8" QUOI DE 9 ! par ROMELARD Fabrice
Speakers: Fabrice Meillon et Stanislas Quastana Cette session est basée entièrement sur celle donnée lors de la BUILD cet hiver. Il n'y a pas d'ajout d'information en rapport avec cet évènement passé. Windows 8 Server sera intégralem...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice [HTML5] AUTOUR DU W3C : NOUVEAUX STANDARDS ET WEB MOBILE (LILLE)[HTML5] AUTOUR DU W3C : NOUVEAUX STANDARDS ET WEB MOBILE (LILLE) par Gio
Je m'y prends un peu tard je sais, mais bon je suis développeur web et donc hyper fainéant ! Toujours dans le cadre des technologies émergentes, ici HTML5, parce qu'on aime HTML5 chez Wyg , nous seront présent, le vieux ( Aurélien V.) et moi, pour pr...
Cliquez pour lire la suite de l'article par Gio [WP7] DYNAMICALLY CHANGE STARTUP PAGE[WP7] DYNAMICALLY CHANGE STARTUP PAGE par KooKiz
Let's say that you want to allow the user to customize the startup page of your application. You can easily change the startup page by editing the 'NavigationPage' attribute in the manifest file. But the manifest cannot be modified once the applicatio...
Cliquez pour lire la suite de l'article par KooKiz
Logiciels
DocTranslate (V3.1.0.0)DOCTRANSLATE (V3.1.0.0)DocTranslate est un traducteur de document Microsoft Word, PowerPoint et Excel. Il permet d'autom... Cliquez pour télécharger DocTranslate Tribler (2012)TRIBLER (2012)Tribler est un client pair à pair (P2P/Peer-to-Peer) open source avec la capacité de regarder des... Cliquez pour télécharger Tribler OneSwarm (2012)ONESWARM (2012)Le peer-to-peer qui protège votre vie privée, c'est OneSwarm.
Ce logiciel de peer-to-peer crypté... Cliquez pour télécharger OneSwarm PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO Academy System (17.2.1.0)ACADEMY SYSTEM (17.2.1.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System
|