Results 1 to 1 of 1
  1. #1
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    330
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Help with Printed Graphic - vbe2008

    Hi All,

    A while back I wrote a small program in vb6 to print out the X,Y co-ords for a given number of evenly spaced holes on a given circle. It also printed out a 1/2 page width size diagram of the holes on the circle, with each hole having a reference number next to it. The diagram never changed in size, only the number of holes would.

    See attached pdf

    When I updated to vbe2008 I was able to find samples of print commands and get it to print the text but the graphic is beyond me.

    I would be extremely grateful if someone could add the appropriate code to my print function for the graphic.

    X,Y lines: fixed size - dashed
    circle: fixed size - dashed
    hole marks: fixed size - solid

    Do...Loop or For...Next statement to print the desired spots at the correct angle and print a reference number offset from it.

    Here is my Print function:

    Code:
        Private Sub cmdPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPrint.Click
            Dim prn As New Printing.PrintDocument
            ' Handle the page events
            AddHandler prn.PrintPage, AddressOf Me.PrintPageHandler
            ' Do the print (Printing handled by the print page handler)
            prn.Print()
            ' Remove the page handler
            RemoveHandler prn.PrintPage, AddressOf Me.PrintPageHandler
        End Sub
    
        Private Sub PrintPageHandler(ByVal sender As Object, ByVal args As Printing.PrintPageEventArgs)
            Dim coord As String
    
            args.Graphics.DrawString("PCD Pattern Co-ordinates", New Font("Arial", 14, FontStyle.Regular), Brushes.Black, 10, 30)
    
            args.Graphics.DrawString("Number of Holes. = " & TextBox1.Text, New Font("Arial", 14, FontStyle.Regular), Brushes.Black, 10, 90)
            args.Graphics.DrawString("PCD = " & TextBox2.Text, New Font("Arial", 14, FontStyle.Regular), Brushes.Black, 10, 120)
            args.Graphics.DrawString("Offset Angle = " & TextBox3.Text, New Font("Arial", 14, FontStyle.Regular), Brushes.Black, 10, 150)
    
            args.Graphics.DrawString("Hole Co-ordinates", New Font("Arial", 14, FontStyle.Regular), Brushes.Black, 10, 210)
    
            For A = 0 To ListBox1.Items.Count - 1
                coord = ListBox1.Items(A)
                args.Graphics.DrawString(coord, New Font("Arial", 14, FontStyle.Regular), Brushes.Black, 10, 240 + A * 30)
    
            Next A
        End Sub
    Attached Files Attached Files
    "Heading for the deep end"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •