[vb6]Alpha Image Control v2 - Final Update (15 Jan 2012) - Page 12-VBForums
Page 12 of 12 FirstFirst ... 29101112
Results 441 to 479 of 479

Thread: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

  1. #441
    Lively Member
    Join Date
    May 2011
    Posts
    86

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Hi

    reference to page 8, post #309
    http://www.vbforums.com/showthread.php?t=630193&page=8

    Not sure I explained myself properly.
    What I was trying to say is:
    1. use Normal image or picture box for the background as this doesn't require transparency,
    2. use Lavolpe component for all other image that require transparency.

    You'll achieve better speed that way as Lavolpe component is running a lot of subroutine in the background and (correct me Lavolpe if I'm wrong) Background image doesn't require all of what Lavolpe component is doing.

    also I don't know your level of expertise in programmation, so ensure your subrountine is all fine tuned in order to use maximum speed. Use API as much as possible instead of low Vb6 class like PSET and such if you require them. I never saw a pokemon game, therefore I don't know what you're trying to achieve, but I once did a replica of Starcraft (not all the game, just the running 191 frames of the intro where you decide wich game type to choose)) with Lavolpe component, so I know the component can handle a lot of stress and action when used correctly.

    I'm rather pretty busy right now but I'll do my best to answer your answer if you have any.

  2. #442
    New Member
    Join Date
    Mar 2012
    Posts
    3

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    ah, helping others is always good and very well rewarded, so i have my Background which is Already a PictureBox. Then The rest of the objects are LaVolpe's Alpha Image Control v1.0

    So my Only Question is.... Moving to Alpha Image Control v2.0 will make things Smoothly or Slower?

    What i use to move the images is a simple loop like this:

    vb Code:
    1. for i = 1 to max_frames
    2.      lavolpesaic.loadpicture = frame(i)
    3.      lavolpesaic.left =  lavolpesaic.left + (i *10)
    4.      sleep 1
    5.      doevents
    6. next i

    Here is a Sample of the Controls from AIC i've used:



    Except that i move like 5 Lavolpes Image Controls a the same time, Resizing and Loading the Images.. All during the same Loop. That happends every time when the person gets into Battle.

    I know this is pretty Basic, and everything seems to move slowly. What am i doing wrong? I apreciate your help here.
    Last edited by alanxp; Apr 26th, 2012 at 12:47 PM.

  3. #443
    Lively Member
    Join Date
    May 2011
    Posts
    86

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Ok, now I understand it more.

    first of all, I see in your code that you are using Doevents and Sleep.

    this is a NO GO... for many reason. one of them is that you'll slow down your entire program.

    you would be better to use a timer with a public variable to keep the frame number as reference instead of your for next loop.

    Doevents is good when you have a LONG process and you want to be able to still click on button and do other thing. it is not recommended otherwise.

    Sleep is to be avoided AT ALL cost, especialy in game.

    during sleep, your program is locked up. and existing of sleep, it will have to take into account everything that happen while it was sleeping, including button clicking, mouse hover and all.
    even if you sleep 1ms, you are still delaying a lot of thing you're not aware of. That's probably the main cause for your lag.

    you're looking for something more like this:
    Code:
    Option Explicit
    
    Public lngframeNo As Long
    
    Private Sub Form_Load()
      lngframeNo = 1
      Timer1.Interval = 15  '(that's the maximum accurency of 98% of computer on the market)  Raise it if it's too fast for you
      Timer1.Enabled = True
    End Sub
    
    Private Sub Timer1_Timer()
        lavolpesaic.LoadPicture = Frame(lngframeNo)
        lavolpesaic.Left = lavolpesaic.Left + (lngframeNo * 10)
        lngframeNo = lngframeNo + 1
        
        If (lngframeNo > max_frames) Then
          lngframeNo = 1
          'Timer1.Enabled = False   'This line is optional.  use it if your sequence END here, don't use it if it's perpetual moving sequence
        End If
    End Sub

    hope that help.

    oh... and if you need even more speed,

    I would recommend an ARRAY of Lavolpe component and getting rid of loadpicture,
    use visible or zorder instead.
    Last edited by VbNetMatrix; Apr 26th, 2012 at 04:33 PM.

  4. #444
    Junior Member
    Join Date
    Aug 2011
    Posts
    28

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Hi. LaVolpe
    Your UnicodeFileDialog Class is very good for me.
    But it has a little bug.

    //Below Code
    ' returns/sets the filename the dialog starts with or returns
    Public Property Get filename() As String
    ...
    lLen = InStr(ofn.nFileOffset, ofn.lpstrFile, vbNullChar) - 1&
    ...
    End Property

    should be changed as below:

    lLen = InStr(ofn.nFileOffset, ofn.lpstrFile, vbNullChar & vbNullChar) - 1&

    otherwise, when select mult files, the filename will only return the path, not all the files's name.

    Please see below link:
    http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx

    lpstrFile
    Type: LPTSTR
    The file name used to initialize the File Name edit control. The first character of this buffer must be NULL if initialization is not necessary. When the GetOpenFileName or GetSaveFileName function returns successfully, this buffer contains the drive designator, path, file name, and extension of the selected file.
    If the OFN_ALLOWMULTISELECT flag is set and the user selects multiple files, the buffer contains the current directory followed by the file names of the selected files. For Explorer-style dialog boxes, the directory and file name strings are NULL separated, with an extra NULL character after the last file name. For old-style dialog boxes, the strings are space separated and the function uses short file names for file names with spaces. You can use the FindFirstFile function to convert between long and short file names. If the user selects only one file, the lpstrFile string does not have a separator between the path and file name.
    If the buffer is too small, the function returns FALSE and the CommDlgExtendedError function returns FNERR_BUFFERTOOSMALL. In this case, the first two bytes of the lpstrFile buffer contain the required size, in bytes or characters.

    Thanks!

  5. #445
    New Member
    Join Date
    Jun 2012
    Posts
    3

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Hi Lavolpe

    Thanks a lot for awesome codes.
    I'm a just beginner.
    I want to set the animated pics to work just 1 cycle(No loop).
    I have tryed using the EndLoopOnFirstFrame function, but it doesn't work.
    I don't know....
    Would you please let me know how to solve it?

    And I have one more question about that when I use the AlphaImgCtl1.Animate2.Stop function.
    How to display the first frame of pics. I mean, get back to the first frame of pics.

    Thanks a lot.

    Private Sub command1_Click()

    AlphaImgCtl1.Animate2.EndLoopOnFirstFrame = True
    AlphaImgCtl1.Animate2.StartAnimation

    End Sub

  6. #446
    Lively Member
    Join Date
    May 2011
    Posts
    86

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Quote Originally Posted by wham View Post
    Hi Lavolpe

    I want to set the animated pics to work just 1 cycle(No loop).
    I have tryed using the EndLoopOnFirstFrame function, but it doesn't work.
    And I have one more question about that when I use the AlphaImgCtl1.Animate2.Stop function.
    How to display the first frame of pics. I mean, get back to the first frame of pics.
    End Sub
    Hi Wham,

    I think the EndLoopOnFirstFrame tell the component to STOP on the first frame AFTER it completed the cycle. Is that what you're trying to accomplish ? I'm not sure I understand your problem properly.
    One more thing, are you using Animated Gif or Animated Png ?

  7. #447
    Lively Member
    Join Date
    May 2011
    Posts
    86

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    ok I found something...

    it is not in the documentation per say but Lavolpe code is pretty well documented.
    so here what we read in the EndLoopOnFirstFrame Code:

    ' default behavior is to have last frame displayed when animation terminates due to loop count met
    ' If desired to display 1st frame instead of last frame, set this property to true

    and here what you have to do:

    AlphaImgCtl1.Animate2.LoopCount = 1 'mean you only want one 1 LOOP of all frame of the image.
    AlphaImgCtl1.Animate2.EndLoopOnFirstFrame = True 'mean that when loop end (it is now on LAST frame), it will display FIRST frame instead
    AlphaImgCtl1.Animate2.StartAnimation 'do the magic..

    hope that help.

  8. #448
    New Member
    Join Date
    Jun 2012
    Posts
    3

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Quote Originally Posted by VbNetMatrix View Post
    ok I found something...

    it is not in the documentation per say but Lavolpe code is pretty well documented.
    so here what we read in the EndLoopOnFirstFrame Code:

    ' default behavior is to have last frame displayed when animation terminates due to loop count met
    ' If desired to display 1st frame instead of last frame, set this property to true

    and here what you have to do:

    AlphaImgCtl1.Animate2.LoopCount = 1 'mean you only want one 1 LOOP of all frame of the image.
    AlphaImgCtl1.Animate2.EndLoopOnFirstFrame = True 'mean that when loop end (it is now on LAST frame), it will display FIRST frame instead
    AlphaImgCtl1.Animate2.StartAnimation 'do the magic..

    hope that help.

    Hi VbNetMatrix,

    Thank you so much!!!!
    It works great!!!!
    Your answer is just what I was looking for.
    Thanks again.

    Thanks to your help, I can save my time.
    I used the below codes. But I don't need it anymore.
    Thank you!!!

    Private Sub AlphaImgCtl1_AnimationFrameChanged(Frame As Long)

    If AlphaImgCtl1.ImageCount = AlphaImgCtl1.Animate2.CurrentFrame Then
    AlphaImgCtl1.Animate2.StopAnimation
    AlphaImgCtl1.Animate2.MoveTo (1)
    End If

    End Sub


    Private Sub AlphaImgCtl1_Click()

    AlphaImgCtl1.Animate2.StartAnimation

    End Sub

  9. #449
    Lively Member
    Join Date
    May 2011
    Posts
    86

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    I'm glad I could help.

    Lavolpe is currently kind of very busy with the BIG NEW release he is preparing.
    we will all enjoy the upcoming release of this excellent component.
    take care.

  10. #450
    Junior Member
    Join Date
    Feb 2008
    Posts
    20

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Is there any reason why UserControl_OLEStartDrag doesn't raise the StartDrag event when set to Automatic?

    Ideally I'd like to set some drag data when the drag starts.

    Code:
    '//// standard OLE event
    Private Sub UserControl_OLEStartDrag(Data As DataObject, AllowedEffects As Long)
        
        Data.Clear
        If Me.OLEDragMode = vbOLEDragAutomatic Then
            If modCommon.SaveImage(m_Image, Data, lvicSaveAsCurrentFormat) Then
                AllowedEffects = vbDropEffectCopy
            Else
                AllowedEffects = vbDropEffectNone
            End If
        Else
            RaiseEvent OLEStartDrag(Data, AllowedEffects)
            ' if user doesn't set AllowedEffects, VB will cancel drag event
        End If
        
    End Sub

  11. #451
    Lively Member
    Join Date
    May 2011
    Posts
    86

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Quote Originally Posted by Stidor View Post
    Is there any reason why UserControl_OLEStartDrag doesn't raise the StartDrag event when set to Automatic?

    Ideally I'd like to set some drag data when the drag starts.

    In order to answer your question, it would need to be more specific.
    are you trying to drag lavolpe control over something else, or trying to drag another control onto Lavolpe control?

  12. #452
    Junior Member
    Join Date
    Feb 2008
    Posts
    20

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Onto another Lavolpe control.

    I replaced standard pictureboxes - which used to fire the StartDrag event with the Lavolpe control which does not fire off the StartDrag event in OLEDrag automatic mode.

    Just curious why?

  13. #453
    Lively Member
    Join Date
    May 2011
    Posts
    86

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    let me do some test...

  14. #454
    Lively Member
    Join Date
    May 2011
    Posts
    86

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    I think the OLE Drag Start is for another purpose (with an external component).

    you're trying to get to know when the drag even start.

    use a boolean flag with a global variable and use the
    DragOver event of the lavolpe component and you'll know when the Drag Start.

    when the object is dropped, cancel your boolean flag.

    tried here, work like a charm.
    Last edited by VbNetMatrix; Jun 30th, 2012 at 09:35 AM.

  15. #455
    Junior Member
    Join Date
    Feb 2008
    Posts
    20

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    I downloaded the latest version from this topic when I was browsing the source.

    This is from the control;

    vb Code:
    1. '//// standard OLE event
    2. Private Sub UserControl_OLEStartDrag(Data As DataObject, AllowedEffects As Long)
    3.    
    4.     Data.Clear
    5.     If Me.OLEDragMode = vbOLEDragAutomatic Then
    6.         If modCommon.SaveImage(m_Image, Data, lvicSaveAsCurrentFormat) Then
    7.             AllowedEffects = vbDropEffectCopy
    8.         Else
    9.             AllowedEffects = vbDropEffectNone
    10.         End If
    11.     Else
    12.         RaiseEvent OLEStartDrag(Data, AllowedEffects)
    13.         ' if user doesn't set AllowedEffects, VB will cancel drag event
    14.     End If
    15.    
    16. End Sub

    As you can see, in Automatic mode StartDrag event is not fired

  16. #456
    Lively Member
    Join Date
    May 2011
    Posts
    86

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    yeah I just check the code and that event is never fired in automatic mode...

    it puzzle me a little but I'm not sure it is an issue. I think only Lavolpe can answer that one.

    however, take a look at that link.

    http://www.datadynamics.com/Help/Sha...ragMode7A.html

    it explain the proper expected behavior.

    I'm hoping Lavolpe could step in and explain us.

    but as I said, you can use the workaround I explained early.

  17. #457
    Junior Member
    Join Date
    Feb 2008
    Posts
    20

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    This is somewhat related, and thought I'd be best asking here.

    What's the possibility of somehow getting alpha images into a the listview control?

  18. #458
    Hyperactive Member
    Join Date
    Jan 2010
    Posts
    363

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Wondering why Lavolpe not appearing on this thread for a long time. I wish him peace and health.

  19. #459
    Lively Member
    Join Date
    May 2011
    Posts
    86

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    same from my part... I really have a lot of admiration for that guy. He gave us a nice product.

  20. #460
    Addicted Member
    Join Date
    Mar 2007
    Location
    India
    Posts
    181

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    I think he is busy developing new version of Alpha Image Control.

    This new version will not be backward compatible!

  21. #461
    New Member
    Join Date
    Sep 2012
    Posts
    4

    Smile Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    hi, i have this LavolpeAlphaImage2 activeX control. what i want is to load a picture in it via common dialog during runtime. how can i possibly do this. kindly show me an example. thanks in advance

  22. #462
    Hyperactive Member
    Join Date
    Jan 2010
    Posts
    363

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Did Anybody know how is Lavolpe doing? Has he changed a new job or was something happened?

  23. #463
    New Member
    Join Date
    Nov 2012
    Posts
    3

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    hi I use THis Control In mY form But When I want Print mY form By form.print this error whas show -----------> error 482 : printer error ? Why this Happen?

  24. #464
    Addicted Member
    Join Date
    Mar 2007
    Location
    India
    Posts
    181

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Try to use following code to load image.

    AlphaImageLib1.Picture = LoadPictureGDIplus("C:\MyTest.jpg")

  25. #465
    Fanatic Member coolcurrent4u's Avatar
    Join Date
    Apr 2008
    Location
    *****
    Posts
    970

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    can this control be used to replace the vb6 one
    Programming is all about good logic. Spend more time here


    (vHost for Apache) (Generate pronounceable password) (Generate random number c#) (Filter array with another array)

  26. #466
    New Member
    Join Date
    May 2013
    Posts
    1

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Hi at all,
    i found this control a fiew days ago, and it is a great one.
    I tested it a fiew times, and i understand the most features.
    My question is, is it possible to shape a form with this control? I have nothin found about it, and no idea to do this.

    Sorry about my bad english! :-)

  27. #467
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    3,142

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Quote Originally Posted by Frido View Post
    My question is, is it possible to shape a form with this control? I have nothin found about it, and no idea to do this.
    No, it can't do that. However, you may want to check out How to Make a Round (Circular) Form and Here's How to Make a Form With a HOLE in it for possible solutions.
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  28. #468
    Junior Member
    Join Date
    Jun 2005
    Posts
    18

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    the image is always distorted when using "apply tolerance" with size reduction
    with any output format

    Name:  untitled.JPG
Views: 448
Size:  62.8 KB

  29. #469
    New Member
    Join Date
    Oct 2013
    Posts
    1

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Hi to all,

    While searching for a alternate image control for MS Access (2010) I found this control. Looks great but I have issues using this ActiveX in MS Access. Would anyone post a sample Access DB to show how to use this control? I need this control to save/retrieve image from the database.

    Thanks in advance.

  30. #470
    Junior Member mleo1's Avatar
    Join Date
    Jul 2010
    Location
    Manila
    Posts
    21

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    How to make this control above other controls. send to back, and send to front does not work

  31. #471
    Addicted Member
    Join Date
    Jun 2009
    Location
    C:\Windows\SysWOW64\
    Posts
    200

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Quote Originally Posted by mleo1 View Post
    How to make this control above other controls. send to back, and send to front does not work
    You can't send it to front. It is a windowless control. It will always be behind other controls.


  32. #472
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    3,142

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Quote Originally Posted by Cube8 View Post
    You can't send it to front. It is a windowless control. It will always be behind other controls.
    Or more precisely, the AlphaImgCtl UserControl can't be positioned on top of any non-graphical control (those with an hWnd property). You can, however, put the AlphaImgCtl in front of any graphical control (such as an Image, Label, Shape or other windowless UserControls) either during design time or at run time via the control's ZOrder method.

    Quote Originally Posted by MSDN
    Three graphical layers are associated with forms and containers. The back layer is the drawing space where the results of the graphics methods are displayed. Next is the middle layer where graphical objects and Label controls are displayed. The front layer is where all nongraphical controls like CommandButton, CheckBox, or ListBox are displayed. Anything contained in a layer closer to the front covers anything contained in the layer(s) behind it. ZOrder arranges objects only within the layer where the object is displayed.
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  33. #473
    Addicted Member
    Join Date
    Jun 2009
    Location
    C:\Windows\SysWOW64\
    Posts
    200

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Indeed. I just gave a simplified answer


  34. #474
    Member
    Join Date
    May 2006
    Posts
    34

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    The IDE will not let me add the "fox" control to a form.
    I get that "prohibet" icon when I hover above a form when the "fox" control is selected.

    Any idea what I am doing wrong?

  35. #475
    Lively Member
    Join Date
    May 2011
    Posts
    86

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    well...
    1. have you registered the component using Administrator privilege ?
    2. make sure IE10 IS NOT installed. if you have installed it BEFORE upgrading to IE11, you need to uninstall IE11, then uninstall IE10, then install IE11 (if you really want IE11)
    plz note that this only affect IDE and IE10 has no bad side effect on compiled program. as for myself, I kept IE9 on my Dev computer because it's the safest course of action.
    Once IE11 is installed, OCA file are no longuer created (ocx transit file) and most OCX will require the file before compilation. Again, the problem only affect DEV machine, not the compiled result.

  36. #476
    Fanatic Member
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    894

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Quote Originally Posted by Bonnie West View Post
    Or more precisely, the AlphaImgCtl UserControl can't be positioned on top of any non-graphical control (those with an hWnd property). You can, however, put the AlphaImgCtl in front of any graphical control (such as an Image, Label, Shape or other windowless UserControls) either during design time or at run time via the control's ZOrder method.
    I haven't played with the control, but I would imagine you could put the control in a panel (or picturebox even), and then adjust the zorder of the container. But, that might defeat the purpose of the control, since the background of the container would be visible and that may be undesirable.
    I should probably read the whole thread, and try the control before commenting, but then I'll probably not get around to it.

  37. #477
    Member
    Join Date
    May 2006
    Posts
    34

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Thanks for your answer. Been using VB6 for a long time. Never registered a component before. Can you tell me how? I googled and did not find much. Thanks!

  38. #478
    Member
    Join Date
    May 2006
    Posts
    34

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Wow! I got it running. Now comes the big question:

    How to add a shadow to the image.
    I have seen La Volpe's work before with PNGs and have seen a shadow effect on some examples.

    Any advice would be welcome.

    David

  39. #479
    Fanatic Member
    Join Date
    Oct 2013
    Posts
    977

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Why don't you start a new thread instead of posting in an old codebank thread?

Page 12 of 12 FirstFirst ... 29101112

Tags for this Thread

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.