Hello everyone,
i passed the whole journey trying to make this function, without success
i need to rescale the StdPicture object without passing throug a picturebox controlCode:public function scalePic (inP as StdPicture, x as long, y as long ) as StdPicture
All I can do now is :
just to be clear , I can do it that way :
1. Load image and generate a dc
2. Scaling the image into an imageboxCode:Dim DC As Long, picTemp As IPictureDisp DC = CreateCompatibleDC(0) If DC < 1 Then Exit Function Set picTemp = LoadPicture("c:\test.jpg") picWidth = ScaleX(picTemp.Width) picHeight = ScaleY(picTemp.Height) SelectObject DC, picTemp
3. Load the picture from the picturebox:Code:StretchBlt Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, picDc, 0, 0, picWidth, picHeight, vbSrcCopy Picture1.Refresh
Then i have a function to save the StdPicture object to jpg fileCode:Dim p As StdPicture Set p = Picture1.Picture
The problem here is that i dont want to use a picturebox in my application, and i can't make the StretchBlt API work without using a picturebox as dest handle
declaration:
any ideaCode:Declare Function StretchBlt Lib "gdi32.dll" ( _ 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![]()




Reply With Quote