Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: VB6 Graphics


Message #1 by "David Beale" <bealers@a...> on Thu, 30 Nov 2000 00:26:49 -0000
Hi David,

i got a suggestion here, since there's no picture box property that wud a
llow u to place the image object in an X,Y coordinate, i suggest that you
 have to do it programmaticaly by changing the pic's control height/width
 relative to the image's height/wid. Try to use the Windows API function 
BitBlt() (or the PaintPicture method) to add image to the picture control
 and resize the control's dimention relative to the load image. Here's a 
sample code:

Sub ResizePictureBoxToImage(pic as PictureBox, twipWd _
  as Integer, twipHt as Integer)
 ' This code assumes that all units are in twips.  If
 ' not, you must convert it to twips before calling
 ' this routine.  This also assumes that the image
 ' was blt'ed to 0,0.
 Dim BorderHt as Integer, BorderWd as Integer
 BorderWd =3D Pic.Width - Pic.ScaleWidth
 BorderHt =3D Pic.Height - Pic.ScaleHeight
 pic.Move pic.Left, pic.Top, twipWd + BorderWd, _
   twipHt + BorderHt
End Sub


Hope this helps you.


Gerald

  Return to Index