Results 1 to 7 of 7

Thread: [RESOLVED] Picture too small

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Resolved [RESOLVED] Picture too small

    I have problem here..

    The picture display to small. How I can large the picture?

    My scale mode is - Twip

    Code:
    Form5.legMapDisp.ExportToBmp (App.path & "\output.bmp")
    Printer.CurrentX = 600
    Printer.CurrentY = 12000:
    'print legend
    Printer.Print "Legend": ForeColor = vbBlack
    Set Picture2 = LoadPicture(App.path & "\output.bmp")
    Printer.PaintPicture Picture2, 60, 13000, 2000, 800

  2. #2
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Picture too small

    How big (Width/Height) and where (X/Y) do you want to Print it?
    This should center the Picture in the sheet (using Twips, real size, no streching)
    Code:
        Printer.PaintPicture Picture2, _
                Printer.ScaleWidth / 2 - ScaleX(Picture2.Width, vbHimetric, vbTwips) / 2, _
                Printer.ScaleHeight / 2 - ScaleX(Picture2.Height, vbHimetric, vbTwips) / 2
                             
        Printer.EndDoc

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Re: Picture too small

    That good.That what I needed.So How I can move the picture by its X and Y location?


    Code:
    Printer.PaintPicture Picture2, _
                Printer.ScaleWidth / 2 - ScaleX(Picture2.Width, vbHimetric, vbTwips) / 2, _
                Printer.ScaleHeight / 2 - ScaleX(Picture2.Height, vbHimetric, vbTwips) / 2

  4. #4
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Picture too small

    Printer.PaintPicture YourPicture, X, Y - 2nd and 3rd parameters are X and Y.

    You can also use Printer.CurrentX and Printer.CurrentY to move to any position.

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Re: Picture too small

    If I put like that it streaching.Right now, the picture show at the center. i just want to move this location but not involved too much changing of the picture location.At the same time I also want to preserve the picture behavior.

    Code:
    Printer.PaintPicture Picture2, 60, 13000, _
                Printer.ScaleWidth / 2 - ScaleX(Picture2.Width, vbHimetric, vbTwips) / 2, _
                Printer.ScaleHeight / 2 - ScaleX(Picture2.Height, vbHimetric, vbTwips) / 2

  6. #6
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Picture too small

    That code is not correct, you added my code in the wrong place, that is suposed to center the picture using parameters 2nd and 3rd, not parameters 4th and 5th, 4th and 5th must be used to stretch, that's another thing.
    I don't know what you mean by: "want to preserve the picture behavior."

  7. #7
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Picture too small

    I assume your X = 60 and Y= 13000 are ok, that must be where you want the Picture to be.
    Now, if you want to Stretch it (make it smaller or bigger) keeping the Picture Ratio (maybe you meant this when you said behavior) use something like this:
    Code:
        Dim lStretch As Single
        
        lStretch = 0.5 'How small/Big it will stretch
        
        Printer.PaintPicture Picture2, 60, 13000, _
            ScaleX(Picture2.Width, vbHimetric, vbTwips) * lStretch, _
            ScaleX(Picture2.Height, vbHimetric, vbTwips) * lStretch
            
        Printer.EndDoc
    If you change the value in lStretch, the Picture Size should change.

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