Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PictureBox and scaling 1

Status
Not open for further replies.

pkailas

Programmer
Jun 10, 2002
555
US
I have an image that, a logo, that I want to place in a picture box. However, the jpg is larger than the space that I can give it. Currently the image gets displayed cropped. Is there an easy way to scale the image, not the control to fit inside the allowed space?

Thanks,

Paul

_______
I love small animals, especially with a good brown gravy....
 
Hi,

if you are free in choosing an image is is simple:
Set the Stretch property to true.

if not you can use the api:

Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long

SmallTalker
 
Which image control are you referring to? I'm using the PictureBox control and I don't see a "stretch" property anywhere.

Does the API work with this control?

_______
I love small animals, especially with a good brown gravy....
 
Never mind. You meant to user the image control, rather than the PictureBox control. That worked, thanks.

_______
I love small animals, especially with a good brown gravy....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top