|
-
Dec 14th, 2015, 06:28 PM
#17
Re: [vb6] Class to make Image Controls Support PNG, TIF, GIF Animation
Updated to address a .Render call bug discussed in previous few replies. Changed ASM source also uploaded
1. The thunk was corrected to allow partial rendering via the VB picture object's .Render method. Does not apply to icons.
2. The thunk was corrected to allow icons to be rendered at different sizes, i.e., Image control's Stretch property set to True.
3. Limitation remains... If picture type is icon and class' .IsManaged = True, cannot partially render icons.
Icons created from this class will not be capable of rendering them partially via the .Render method of the VB picture object, just entire image. They can be rendered at different sizes. Though VB will allow partial rendering, I decided the fix would require a massive rewrite of the subclassing thunk and not worth it. You do have a couple of options though.
a) After sending an icon to this class to load into a picture object, if the IsManaged property returns true and the .Type property returns vbPicTypeIcon, call the UnManage method. That will release the subclassing and keep the picture as an icon if required, i.e., a hIcon handle. Once unmanaged, you can use the .Render method of the picture object since VB will be rendering it now. You will be stuck with VB's limits in displaying 32 bit alpha blended icons.
b) If you know you will not need the picture to be an icon, that is, you just want it to be displayed in your project, you can pass the optional RequiredFormat to be vbPicTypeBitmap. This will convert the icon to bitmap, it will not be a hIcon but a hBitmap instead. As a bitmap, you can use the .Render method for partial rendering.
c) If neither of the above prove acceptable, then you can always take control manually. Whatever DC you will be using in the .Render call, create a clipping region on the DC to prevent any drawing outside the region. Render the image in its entirety, remove the clipping region. This would be the exact same result as partial rendering.
Last edited by LaVolpe; Dec 14th, 2015 at 06:38 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|