Writing text into a picture box


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Writing text into a picture box

  1. #1
    Wanda Guest

    Writing text into a picture box


    Hi,

    I have created an app in VB6 that displays maps (bmp's). I need to write
    information onto the map and then print it. I am currently using labels
    and then printform, but I need to be able to make the map a certain size
    on the printout and then make use of the rest of the page for other text.
    Is there a way to do this?

    Thank-you.

    Wanda

  2. #2
    Russell P. Holsclaw Guest

    Re: Writing text into a picture box

    Yes.
    In your picture box, set the "autoredraw" property to True, and then load in
    your bitmap. Use the "picturebox.print" method to add the text to the bitmap
    data.

    The Autoredraw property creates a "background" bitmap object that contains
    anything you put into the picturebox

    To print it, use:

    Printer.paintpicture Picture1.Image,x,y

    ....where x,y tells it where to put the picture on the page. You can also add
    Height and Width parameters to the method to change the size of the image on
    the printout to something other than its size on the screen in twips. (I'm
    assuming both your picturebox and your printerobjects are still scaled in
    Twips by default here, or some other linearly-scaled unit of measure other
    than pixels. If you use pixels as the unit on the printer, the picture will
    print out very small, according to the printer's dpi resolution, and not a
    device-independent linear measurement.)

    The Image property refers to the bitmap maintained for "autorefresh" that
    correponds to the visible picturebox, as updated by your "Print" statements
    and other drawing methods that your program might use to annotate the bitmap
    data.

    Do not use the "Picture" property, as this refers to the bitmap that you
    loaded your original map into, and not the "autoredraw" image which includes
    the added text.

    (I know the documentation for the PaintPicture method doesn't mention the
    Image property as an option, but when does Microsoft ever tell the whole
    story in their documentation?)

    Note: the text that prints is the bitmapped image of what appears in the
    picturebox on your screen. As such, it will look a bit pixelated (jaggy),
    and not as smooth as text normally appears when printed to the printer
    directly. If you want the text smoother, you'll have to use PaintPicture
    with the "picture" property to print the unannoted bitmap, and then add the
    text directly to the Printer object (the page, that is), by using
    "Printer.Print" to put the text directly on the page, on top of the
    bitmapped image at the desired page coordinates.


    --
    Russ Holsclaw


  3. #3
    John Knoop Guest

    Re: Writing text into a picture box

    Picturebox.CurrentX = <left startposition>
    Picturebox.CurrentY = <top startposition>
    Picturebox.Print "<your text>"

    "Wanda" <kagume@monarch.net> wrote in message
    news:3bc709e1$1@news.devx.com...
    >
    > Hi,
    >
    > I have created an app in VB6 that displays maps (bmp's). I need to write
    > information onto the map and then print it. I am currently using labels
    > and then printform, but I need to be able to make the map a certain size
    > on the printout and then make use of the rest of the page for other text.
    > Is there a way to do this?
    >
    > Thank-you.
    >
    > Wanda




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center