PDA

Click to See Complete Forum and Search --> : [RESOLVED] about propertyies


joaquim
Aug 3rd, 2008, 01:02 PM
i'm using visual basic 6...
when i do a property, did i must put the entire code(or call a procedure) in write and read properties usercontrol events(these properties must be used in property visual basic 6 window)?
thanks

joaquim
Aug 5th, 2008, 03:00 PM
what isn't right with these property(and works)?
the code is like is ignored in read and write properties usercontrol events:

Public Enum AnimationState
AnimationStopped = 0
AnimationPlay = 1
AnimationPause = 2
End Enum

Dim aniAnimationState As AnimationState

Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
Animation = PropBag.ReadProperty("Animation", 0)
end sub

Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
PropBag.WriteProperty "Animation", Animation, 0
end sub

Public Property Get Animation() As AnimationState
Animation = aniAnimationState
End Property

Public Property Let Animation(ByVal vNewValue As AnimationState)
aniAnimationState = vNewValue
If ((aniAnimationState = AnimationPlay And lngTotalSubImages = 1) Or aniAnimationState = AnimationStopped) Then
aniAnimationState = 0
tmrAnimation.Enabled = False
If Strip.Activate = False Then
lngActualSubImage = 0
Else
lngActualSubImage = 1
End If
ElseIf aniAnimationState = AnimationPause Then
If tmrAnimation.Enabled = True Then
tmrAnimation.Enabled = False
Else
tmrAnimation.Enabled = Ambient.UserMode
End If
ElseIf aniAnimationState = AnimationPlay Then
If lngTotalSubImages > 1 Then tmrAnimation.Enabled = Ambient.UserMode
End If
PropertyChanged "Animation"
End Property
the error is: when i change the animation property, in project mode, these changes aren't made in execute mode... why?
but if i change in execute mode, works fine.
thanks

joaquim
Aug 11th, 2008, 09:54 AM
heres my groupproject for test it...
in these groupproject i have a teste form and the sprite control for test it.
if you change the Animation property(in project mode) for animationstopped(for example) and then you execute, you will see that isn't happen...
my question is: why the sprite don't stop/pause the image animation(but play it)?
note: if i change the property in run mode, don't give me any problem...
for be more explicit i edit my groupproject....
thanks

joaquim
Aug 16th, 2008, 12:37 PM
i have tested again and i can see a problem:
the animation property value is fine, the tmranimation.enable value is fine... but when i execute the program the timer change(for a round value) is value, why?
thanks

joaquim
Aug 16th, 2008, 12:51 PM
finally i resolve my problem...
thanks
i change something in timer event:
Private Sub tmrAnimation_Timer()
If blnDestroyed = True Then
tmrAnimation.Enabled = False
Exit Sub
End If
On Error GoTo erro
If Animation = AnimationPause Or Animation = AnimationStopped Then
tmrAnimation.Enabled = False
Exit Sub
End If
Const Transparency = (50 * 255) / 100 * &H10000
If lngActualSubImage < PicAnimation.Count - 1 Then
lngActualSubImage = lngActualSubImage + 1
Else
If Strip.Activate = True Then
lngActualSubImage = 1
Else
lngActualSubImage = 0
End If
End If
Set UserControl.Picture = Nothing
UserControl.Cls
If blnStretch = True Then
StretchBlt UserControl.hdc, 0, 0, UserControl.ScaleWidth, UserControl.ScaleHeight, PicAnimation(lngActualSubImage).hdc, 0, 0, PicAnimation(lngActualSubImage).Width, PicAnimation(lngActualSubImage).Height, vbSrcCopy
ElseIf blnAlphaBlend = True Then
AlphaBlend UserControl.hdc, 0, 0, UserControl.ScaleWidth, UserControl.ScaleHeight, PicAnimation(lngActualSubImage).hdc, 0, 0, _
PicAnimation(lngActualSubImage).ScaleWidth, PicAnimation(lngActualSubImage).ScaleHeight, Transparency
Else
UserControl.Picture = PicAnimation(lngActualSubImage).Image
End If
Call SubTransparent
RaiseEvent ChangeImage(lngActualSubImage)
Exit Sub
erro:
tmrAnimation.Enabled = False
MsgBox Err.Description
End Sub
thanks