Need help centering image with g.DrawPicture

Hi All,

I am using the g.DrawPicture method to create a document for printing. However, I can’t get the image to center on the page HORIZONTALLY no matter what size the image may be. Here is the code I have tried:

  If companyPic <> Nil Then
    Dim pic As Picture
    pic = Picture.Open(companyPic)
    g.DrawPicture(pic, g.Width - pic.Width * 1.9, 150)
  End if

Any ideas?

(g.width-pic.width)/2

Order of operations. The multiplying is happening before the subtraction. Use parentheses as Dave demonstrated.

Thanks Dave!

Your answer was the exact solution I needed.

You Rock!