Your screen shot does not help exactly. We do not know what the source looks like.
You are using PicAnimation(...).Width & PicAnimation(...).Height. Those measurements are in the scalemode of the container where the PicAnimation control resides. If not vbPixels, ensure you convert to pixels. If the PicAnimation controls have borders, suggest not using Width,Height but use ScaleWidth,ScaleHeight
Insomnia is just a byproduct of, "It can't be done"
Your screen shot does not help exactly. We do not know what the source looks like.
You are using PicAnimation(...).Width & PicAnimation(...).Height. Those measurements are in the scalemode of the container where the PicAnimation control resides. If not vbPixels, ensure you convert to pixels. If the PicAnimation controls have borders, suggest not using Width,Height but use ScaleWidth,ScaleHeight
everything is in pixels, autoredraw is true and the border is none. and i try use the scale size, but the results are the same(except being big, is small. but tell me 1 thing if i use the control size(see the blue points), why the image have a diferent size?
I think it is not a good idea to hardcode some constants. You are not getting the correct result because of something else. To answer your question in post #3, I can't tell you unless you show us the source picturebox with the image in it.
Insomnia is just a byproduct of, "It can't be done"
I think it is not a good idea to hardcode some constants. You are not getting the correct result because of something else. To answer your question in post #3, I can't tell you unless you show us the source picturebox with the image in it.
the picanimation() is for recive the image\subtimage original. then i use the if's for do the effects:
Code:
If blnStretch = True Then
StretchBlt UserControl.hDC, 0, 0, UserControl.ScaleWidth * (Screen.TwipsPerPixelX - 9), UserControl.ScaleHeight * (Screen.TwipsPerPixelY - 12), UserControl.hDC, 0, 0, PicAnimation(lngActualSubImage).ScaleWidth, PicAnimation(lngActualSubImage).ScaleHeight, vbSrcCopy
UserControl.Picture = UserControl.Image
End If
but. like you said, can give some bad resultes... and i recive bad image results in some images
what you need to know more?
or i can put here a link(because i don't have space in my attachment file) and show you my work(entire project).. just say it
i can show the image\subimage, without a problem, in autosize true(because without these effect the animation\static works normaly). my problem is try to sretch the image.
1 big question: if my uc is in pixel and the form is in pixel, why the size is diferent?
inside of uc: the width is 690;
in form: the width is 46.
now tell me something?
(i debug these for see the results)
or i must use the api function?
UserControl.Width,Height are always in Twips: 690 in your case. Same as a form's Width,Height are always in Twips.
UserControl.ScaleWidth,ScaleHeight are in usercontrol's ScaleMode: 46 in your case
In post #2 above I tried to explain that to you. A control's Width,Height values are always in the control's container's scalemode. So UserControl1.Width will be in the uc's container's scalemode. UserControl1.Width is not the same as UserControl.Width called from within the uc.
Insomnia is just a byproduct of, "It can't be done"
UserControl.Width,Height are always in Twips: 690 in your case. Same as a form's Width,Height are always in Twips.
UserControl.ScaleWidth,ScaleHeight are in usercontrol's ScaleMode: 46 in your case
In post #2 above I tried to explain that to you. A control's Width,Height values are always in the control's container's scalemode. So UserControl1.Width will be in the uc's container's scalemode. UserControl1.Width is not the same as UserControl.Width called from within the uc.
ok. i understand that. but now i still have the same question: why that width(in these case) bug?
i'm good hehehehe
i found the solution:
1 - i have 1 picturebox for catch the real image size and works 100% fine;
2 . i use the Extender object for catch the actual usercontrol size and works fine.
Code:
If blnStretch = True Then
StretchBlt UserControl.hDC, 0, 0, Extender.Width, Extender.Height, UserControl.hDC, 0, 0, imgSize.Width, imgSize.Height, vbSrcCopy
UserControl.Picture = UserControl.Image
End If
my little problem is if i reduze the original size(in UC) the image is showed like a double in diferent size. i belive that is something that i forget in that IF. can you advice me more?
There is no stretchblt bug I'm aware of. If you can show us a screenshot of the source picturebox with its image and then the result so we can better understand what the problem is, we might be able to offer more advice
Insomnia is just a byproduct of, "It can't be done"
There is no stretchblt bug I'm aware of. If you can show us a screenshot of the source picturebox with its image and then the result so we can better understand what the problem is, we might be able to offer more advice
see the image. these bug only happens when the size is less than original
If your source and destination picboxes are not the same size ratios then your image will appear to be stretched horizontally or vertically vs scaled. If your source picbox contains a bunch of blank space around the image, then the destination picbox will contain that extra space also when you StretchBlt.
If you need to just blt the area around the source image, excluding any extra space, you will have to calculate a tight rectangle around the image and just StretchBlt that rectangle's dimensions.
Regarding size ratios: If (sourceWidth/destWidth) <> (sourceHeight/destHeight) then you will not get a scaled rendering and you will have to determine what horizontal/vertical ratios to use.
Insomnia is just a byproduct of, "It can't be done"
If your source and destination picboxes are not the same size ratios then your image will appear to be stretched horizontally or vertically vs scaled. If your source picbox contains a bunch of blank space around the image, then the destination picbox will contain that extra space also when you StretchBlt.
If you need to just blt the area around the source image, excluding any extra space, you will have to calculate a tight rectangle around the image and just StretchBlt that rectangle's dimensions.
Regarding size ratios: If (sourceWidth/destWidth) <> (sourceHeight/destHeight) then you will not get a scaled rendering and you will have to determine what horizontal/vertical ratios to use.