Mica Posted June 12, 2012 at 06:55 PM Report Share #462340 Posted June 12, 2012 at 06:55 PM (edited) boas tardes.. eu tou a trabalhar em visual basic 2008 e queria criar um botao imprimir... eu encontrei o seguinte codigo Private Sub ButtonImprimir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonImprimir.Click Dim clidocument As Drawing.Printing.PrintDocument clidocument = New Drawing.Printing.PrintDocument() clidocument.DocumentName = "clientes" AddHandler clidocument.PrintPage, AddressOf Me.Imprimirclientes Dim savedposition As Integer = clienteCManager.Position dlgvisualizar.document = clidocument dlgvisualizar.showdialog() clidocument.Dispose() clienteCManager.Position = savedposition End Sub Private Sub Imprimirclientes(ByVal sender As Object, ByVal e As Drawing.Printing.PrintPageEventArgs) Dim MyPen As Pen = New Pen(Color.Black, 3) e.Graphics.DrawRectangle(MyPen, e.MarginBounds.X, e.MarginBounds.Y, 450, 480) Dim MyFont As Font = New Font("Arial", 12, FontStyle.Bold) Dim s As String = My.Settings.fotosclientes.ToString Dim SSize As SizeF = e.Graphics.MeasureString(s, MyFont) e.Graphics.DrawString(s, MyFont, Brushes.Black, e.MarginBounds.X + CInt(0.5 * (450 - SSize.Width)), e.MarginBounds.Y + 15) ' e.HasMorePages = False MyFont = New Font("Arial", 11) Dim y As Integer = e.MarginBounds.Y + 600 s = TextBox2.Text + " " + TextBox3.Text SSize = e.Graphics.MeasureString(3, MyFont) e.Graphics.DrawString(3, MyFont, Brushes.Black, e.MarginBounds.X + CInt(0.5 * (450 - SSize.Width)), y) y += CInt(MyFont.GetHeight(e.Graphics)) SSize = e.Graphics.MeasureString(3, MyFont) e.Graphics.DrawString(3, MyFont, Brushes.Black, e.MarginBounds.X + CInt(0.5 * (450 - SSize.Width)), y) End Sub mas so que da erro alguem sabe o que pode ser ou sabe outro tipo de codigo para fazer o butao Edited June 13, 2012 at 06:45 AM by jpaulino Formato o código Link to comment Share on other sites More sharing options...
jpaulino Posted June 13, 2012 at 06:46 AM Report Share #462403 Posted June 13, 2012 at 06:46 AM Mas queres imprimir o quê? E que erro dá? Link to comment Share on other sites More sharing options...
Mica Posted June 13, 2012 at 10:26 AM Author Report Share #462429 Posted June 13, 2012 at 10:26 AM ja consegui obrigado na mesma Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now