Results 1 to 5 of 5

Thread: [RESOLVED] about propertyies

  1. #1

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Resolved [RESOLVED] about propertyies

    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
    VB6 2D Sprite control

    To live is difficult, but we do it.

  2. #2

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    about propertyies

    what isn't right with these property(and works)?
    the code is like is ignored in read and write properties usercontrol events:

    Code:
    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
    VB6 2D Sprite control

    To live is difficult, but we do it.

  3. #3

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: about propertyies

    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
    Attached Files Attached Files
    Last edited by joaquim; Aug 12th, 2008 at 03:14 PM.
    VB6 2D Sprite control

    To live is difficult, but we do it.

  4. #4

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: about propertyies

    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
    VB6 2D Sprite control

    To live is difficult, but we do it.

  5. #5

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: about propertyies

    finally i resolve my problem...
    thanks
    i change something in timer event:
    Code:
    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
    VB6 2D Sprite control

    To live is difficult, but we do it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width