Results 1 to 3 of 3

Thread: i need some advices

  1. #1

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

    i need some advices

    i have 1 property in my UC:
    Code:
    Public Property Get FileName() As String
        FileName = strFileName
    End Property
    
    Public Property Let FileName(New_FileName As String)
        Dim I As Integer
        strFileName = New_FileName
        tmrAnimation.Enabled = False
        If (Dir(strFileName) = "" Or ValidFile(UCase(strFileName)) = False) Then
            UserControl.Picture = Nothing
            UserControl.MaskPicture = Nothing
            UserControl.MaskColor = vbNull
            UserControl.Cls
            Strip.Activate = False
            StripsActivate = Strip.Activate
            lngActualSubImage = 0
            lngTotalSubImages = 0
            aniAnimation = AnimationStopped
            If PicAnimation.Count > 1 Then
                For I = 1 To PicAnimation.Count - 1
                    Unload PicAnimation(I)
                    If shpSubImage.Count > 1 Then
                        Unload shpSubImage(I)
                    End If
                Next I
            End If
            Exit Property
        End If
        If PicAnimation.Count > 1 Then
            For I = 1 To PicAnimation.Count - 1
                Unload PicAnimation(I)
                If shpSubImage.Count > 1 Then
                    Unload shpSubImage(I)
                End If
            Next I
        End If
        If (UCase(strFileName) Like "*.GIF") Then
            If LoadGif(strFileName, PicAnimation) = True Then
                If PicAnimation.Count = 1 Then
                    PicAnimation(0).Picture = LoadPicture(strFileName)
                Else
                    lngChangeImageTime = TimeSpeed
                    tmrAnimation.Interval = lngChangeImageTime
                End If
            End If
            UserControl.Width = PicAnimation(0).ScaleWidth * Screen.TwipsPerPixelX
            UserControl.Height = PicAnimation(0).ScaleHeight * Screen.TwipsPerPixelY
        ElseIf (UCase(strFileName) Like "*.ANI") Or (UCase(strFileName) Like "*.CUR") Then
            If AnimatedCursor(strFileName, PicAnimation) Then
                If PicAnimation.Count > 1 Then tmrAnimation.Interval = lngChangeImageTime
                If blnAutoSize = True Then
                    UserControl.Width = PicAnimation(0).ScaleWidth * Screen.TwipsPerPixelX
                    UserControl.Height = PicAnimation(0).ScaleHeight * Screen.TwipsPerPixelY
                End If
            End If
        Else
            tmrAnimation.Enabled = False
            PicAnimation(0).Picture = LoadPicture(strFileName)
        End If
        lngActualSubImage = 0
        lngTotalSubImages = IFF(Strip.Activate = True, PicAnimation.Count - 1, PicAnimation.Count)
        If Strip.Activate = True Then
            If blnAutoSize = True Then
                UserControl.Width = PicAnimation(1).ScaleWidth * Screen.TwipsPerPixelX
                UserControl.Height = PicAnimation(1).ScaleHeight * Screen.TwipsPerPixelY
            End If
        Else
            If blnAutoSize = True Then
                UserControl.Width = PicAnimation(0).ScaleWidth * Screen.TwipsPerPixelX
                UserControl.Height = PicAnimation(0).ScaleHeight * Screen.TwipsPerPixelY
            End If
        End If
        If lngTotalSubImages = 1 Then
            If Strip.Activate = True Then
                UserControl.Picture = PicAnimation(1).Image
                UserControl.BackColor = PicAnimation(1).BackColor
            Else
                UserControl.Picture = PicAnimation(0).Image
                UserControl.BackColor = PicAnimation(0).BackColor
            End If
        Else
            If Strip.Activate = True Then
                UserControl.Picture = PicAnimation(1).Image
                UserControl.BackColor = PicAnimation(1).BackColor
            Else
                UserControl.Picture = PicAnimation(0).Image
                UserControl.BackColor = PicAnimation(0).BackColor
            End If
            aniAnimation = AnimationPlay
            tmrAnimation.Enabled = True
        End If
        If UCase(strFileName) Like "*.GIF" And PicAnimation.Count > 1 Then lngActualSubImage = PicAnimation.Count - 1
        Col.Height = Extender.Height
        Col.Left = Extender.Left
        Col.Top = Extender.Top
        Col.Width = Extender.Width
        StripsActivate = Strip.Activate
        DoEvents
        Call ShowImage
        PropertyChanged "FileName"
    End Property
    everytime that i call it, in keydown event, is very slow.... can stop my UC in more or less 2 seconds.... can anyone advice me?
    thanks
    VB6 2D Sprite control

    To live is difficult, but we do it.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: i need some advices

    How many files and/or images is it processing and how large are they?

  3. #3

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

    Re: i need some advices

    Quote Originally Posted by Hack View Post
    How many files and/or images is it processing and how large are they?
    in these case i have 4 directions, i have 4 animated and 4 static images... they appear depending on movement or not movement. the animated gif has 3 or 4 subimages not more.
    if you want i can put here my game, here i'm testing 100% my UC, but the problem is that you need(in these project game) my OCX file.
    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