Results 1 to 13 of 13

Thread: [RESOLVED] Card printing

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2005
    Posts
    51

    Resolved [RESOLVED] Card printing

    I'm trying to make a program to print bingo cards. I have the card images made without numbers on them. I'm looking for a good way to print the cards with the numbers on them. How can I do that?
    Last edited by simgirl; Feb 16th, 2006 at 12:20 PM. Reason: Resolved

  2. #2
    Addicted Member Quizton's Avatar
    Join Date
    Dec 2005
    Location
    VB Forums
    Posts
    209

    Re: Card printing


    If youd like to randomly generate the numbers here is a simple sample using a commandbutton1 and a label label1

    VB Code:
    1. Private Sub Command1_Click()
    2. label1.caption = Int(Rnd * 50)'may change to set the max number to generate
    3. 'also can add label2,label3,label4,ect.....
    4. End Sub

    now you could place several labels in a picbox that has your image in it
    and set the textboxes to transparent backround
    (to blend in with your image) you could add diff font and sizes to the labels caption and then you could randomly generate the numbers and then print the picbox with
    picture1.print

    Is this generaly what your after?
    also this would be about as basic as it gets if youd like it to print full pages of the cards that would be a diff story

    _________________________________________________________________
    Please rate if I have been helpful
    Last edited by Quizton; Feb 9th, 2006 at 03:54 AM.

  3. #3
    Hyperactive Member guyvdn's Avatar
    Join Date
    Oct 2002
    Location
    Belgium
    Posts
    336

    Re: Card printing

    You can print the numbers on the picturebox, then you don't have to create the textboxes.

    VB Code:
    1. Private Sub Command1_Click()
    2.   'Print numbers on Picture
    3.   Dim iRow As Integer
    4.   Dim iCol As Integer
    5.   Dim number As Integer
    6.  
    7.   Picture1.FontSize = 14
    8.   Picture1.FontBold = True
    9.   Picture1.AutoRedraw = True
    10.  
    11.   For iRow = 0 To 5
    12.    For iCol = 1 To 10
    13.       number = (iRow * 10) + iCol
    14.       Picture1.CurrentY = iRow * 400
    15.       Picture1.CurrentX = iCol * 500 - TextWidth(number) * 2
    16.       Picture1.Print number
    17.     Next iCol
    18.   Next iRow
    19.  
    20. End Sub
    21.  
    22. Private Sub Command2_Click()
    23.   'Send image to printer
    24.   Printer.PaintPicture Picture1.Image, 100, 100
    25.   Printer.EndDoc
    26.  
    27. End Sub
    To deny our own impulses is to deny the very thing that makes us human

  4. #4
    Addicted Member Quizton's Avatar
    Join Date
    Dec 2005
    Location
    VB Forums
    Posts
    209

    Re: Card printing

    yeah I went to fast as well I should have been using labels with transparent set
    I edited the original post

    Nice way to do it as well guyvdn

  5. #5

    Thread Starter
    Member
    Join Date
    Feb 2005
    Posts
    51

    Re: Card printing

    Thanks, that information & code helps. I got 1 last question related to this. How do I get the cards to print at a certain size? I want the cards to be 4 inches by 4 inches printed.

  6. #6
    Hyperactive Member guyvdn's Avatar
    Join Date
    Oct 2002
    Location
    Belgium
    Posts
    336

    Re: Card printing

    Set the scale mode of the printer to Inch and add extra parameters to the PaintPicture function.

    VB Code:
    1. Printer.ScaleMode = 5 'Inch
    2.     Printer.PaintPicture Picture, Xpos, Ypos, Width, Height
    To deny our own impulses is to deny the very thing that makes us human

  7. #7

    Thread Starter
    Member
    Join Date
    Feb 2005
    Posts
    51

    Re: Card printing

    I've got the cards made now and displayed on the form. I've got 4 cards made to print per page. My problem is getting the cards to print now. How can I print the 4 cards? I've use the code Guyvdn mention to make the cards.
    Last edited by simgirl; Feb 12th, 2006 at 08:59 PM.

  8. #8
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: Card printing

    you can put the code into a loop and use the same code (guyvdn) to print the cards
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


  9. #9
    Hyperactive Member guyvdn's Avatar
    Join Date
    Oct 2002
    Location
    Belgium
    Posts
    336

    Re: Card printing

    I also provided the code to get the picture printed

    Quote Originally Posted by guyvdn
    VB Code:
    1. Private Sub Command2_Click()
    2.   'Send image to printer
    3.   Printer.PaintPicture Picture1.Image, 100, 100
    4.   Printer.EndDoc
    5. End Sub
    To deny our own impulses is to deny the very thing that makes us human

  10. #10

    Thread Starter
    Member
    Join Date
    Feb 2005
    Posts
    51

    Re: Card printing

    Wouldn't that only send 1 card to the printer at a time? How do you do it for 4-6 cards to print on a piece of paper at a time?

  11. #11
    Hyperactive Member guyvdn's Avatar
    Join Date
    Oct 2002
    Location
    Belgium
    Posts
    336

    Re: Card printing

    Like this

    VB Code:
    1. Printer.PaintPicture Picture1.Image, 100, 100
    2. Printer.NewPage
    3. Printer.PaintPicture Picture2.Image, 100, 100
    4. Printer.NewPage
    5. Printer.PaintPicture Picture3.Image, 100, 100
    6. Printer.NewPage
    7. Printer.PaintPicture Picture4.Image, 100, 100
    8. Printer.EndDoc
    To deny our own impulses is to deny the very thing that makes us human

  12. #12
    Hyperactive Member guyvdn's Avatar
    Join Date
    Oct 2002
    Location
    Belgium
    Posts
    336

    Re: Card printing

    If you want 4 cards on one page you have to play with the x1, y1 parameters to set the postions

    VB Code:
    1. Printer.PaintPicture Picture1.Image, 100, 100
    2. Printer.PaintPicture Picture2.Image, 300, 100
    3. Printer.PaintPicture Picture3.Image, 100, 300
    4. Printer.PaintPicture Picture4.Image, 300, 300
    5. Printer.EndDoc
    To deny our own impulses is to deny the very thing that makes us human

  13. #13

    Thread Starter
    Member
    Join Date
    Feb 2005
    Posts
    51

    Re: Card printing

    Thank you. I'll try that.

Posting Permissions

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



Click Here to Expand Forum to Full Width