Re: [vb6] Class to make Image Controls Support PNG, TIF, GIF Animation
Give up.
IPicture.Render hardly do partial painting at vertical direction. But Horizontal can be partial. Am I right?
Code:
Public Function Render(ByVal hdc As Long, _
Optional ByVal destX As Single, Optional ByVal destY As Single, _
Optional ByVal destWidth As Single, Optional ByVal destHeight As Single, _
Optional ByVal srcX As Single, Optional ByVal srcY As Single, _
Optional ByVal srcWidth As Single, Optional ByVal srcHeight As Single) As Boolean
'-- If using variables, surround them with parentheses, i.e., (x), (y)
'-- You can use numbers as is, i.e., 0, 256
'-- The destination coordinates and dimensions are in pixels (scale your destination parameters to pixels)
'-- The source coordinates and dimensions are in himetrics (scale your source parameters to himetric)
'Remember to use the negative height as shown in that other post of mine
If srcWidth = 0 Then
srcWidth = m_objPicture.Width
Else
srcWidth = srcWidth * 2540& * Screen.TwipsPerPixelX / 1440&
End If
If srcHeight = 0 Then
srcHeight = -(m_objPicture.Height)
Else
srcHeight = -(srcHeight * 2540& * Screen.TwipsPerPixelY / 1440&)
End If
With m_objPicture
'.Render (hdc), (destX), (destY), (destWidth), (destHeight), 0, (.Height - 1&), .Width, -.Height, ByVal 0&
.Render (hdc), (destX), (destY), (destWidth), (destHeight), _
(srcX * 2540& * Screen.TwipsPerPixelX / 1440&), (m_objPicture.Height - 1 - (srcY * 2540& * Screen.TwipsPerPixelY / 1440&)), _
(srcWidth), (srcHeight), ByVal 0&
Debug.Print srcHeight,m_objPicture.Height
End With
End Function
For Example, If srcHeight is -4947.708 (Image Height is 5715), the whole graphic disappear.
Hard to understand why VB6 design .Render should give a negative value.