Page 6 of 7 FirstFirst ... 34567 LastLast
Results 201 to 240 of 271

Thread: [VB6] - animated gif function errors:(

  1. #201

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

    Re: [VB6] - animated gif function errors:(

    Quote Originally Posted by jmsrickland View Post
    What you do is search from one 21F9 to the next 21F9 and assume that is your images data you want and in some cases it will work but in other cases it will not work. Meter.gif is a good example of one that does not work using your method. When I try to use your output files in a Gif Image Viewer they are all invalid gif files but they are OK for just loading them back into a Picturebox because the Picturebox does not care if the file is invalid or not as long as there is an image in it. The fact that you are outputting invalid gif files tells you that your code is not right. I don't know where you got that code but who ever made it didn't understand the gif format completely. In the case of the meter.gif what is happening is you are displaying the same image over and over again but using the Left and Top values of the other frames and that is what is causing the flickering like results.

    Here are some of the things you are doing incorrectly:

    1) You search for the 1st 21F9 and assume that is the end of the Global Color Table. Then you make that your Header Block but that will not always work (meter.gif is an example). DO NOT use the 1st 21F9 as the end of the Color Table, use the exact length of the table.

    2) You only search for 21F9 code and assume that is the image data you need but image data can also appear in a 21FF block so you ignore the image in these blocks and now you have an invalid gif file. This is what happened when you tried to animate the meter.gif; you actually put an image in the Header Block and then attached another image to it from your actualFrame data thus make a 2-image file. When you load that file back into a Picturebox only the 1st image is placed in the Picturebox which is the same image for all of the frames.

    3) You are using the Index to the color table as the actual background color and this is incorrect. The Index points to the actual background color in the color table. In most cases you wind up with black because the Index is 0 and 0 is black.

    4) You use GetPixel API to get the transparent color (or background color) from the 0,0 of the image and this is incorrect. The transparent color is in the color table and it has an Index to it just like the background color.
    the size of table is expressed on Bytes?
    (i can see the value, like you see on my code... but i don't know if it's in Bytes or other way)
    VB6 2D Sprite control

    To live is difficult, but we do it.

  2. #202
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [VB6] - animated gif function errors:(

    Tell you what. Instead of trying to explain things to you and trying to help you straighten out your code which as it is written you probably will spend many more weeks on getting it right, if ever, why don't I just re-write your project using my code which is correct and attaching it to your Form code. Would you want me to do that?


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  3. #203

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

    Re: [VB6] - animated gif function errors:(

    Quote Originally Posted by jmsrickland View Post
    Tell you what. Instead of trying to explain things to you and trying to help you straighten out your code which as it is written you probably will spend many more weeks on getting it right, if ever, why don't I just re-write your project using my code which is correct and attaching it to your Form code. Would you want me to do that?
    but my objective is learn more that you teach me
    thanks to you, i know:
    1 - that binary files use blocks and 1 block is 1 Byte and 1 byte is a ascii char(then i must convert it);
    2 - the gif struture.
    i apreciate everything that you did for me, realy... and some parts i don't get them, for now, but i will.
    if you write the all code:
    1 - you have all the credits;
    2 - can i learn more from it?
    i must understand what it's incorrect with my code. but not all manuals can tell us everything, but your experience can
    can you tell me somethings that i need to know for correct my errors?
    1 - i see that i can't think on gif ends, but where the color table ends. but for that i need to understand how calculate the size
    2 - i understand that i need the use the frame Backcolor, instead the gif backcolor or the getpixel(), and the transparent color if is used... problem: i must understand how calculate the frame backcolor.
    but, if i'm bored you, i'm realy sorry about that
    VB6 2D Sprite control

    To live is difficult, but we do it.

  4. #204
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [VB6] - animated gif function errors:(

    Well, there are two ways to learn, the right way and the wrong way. In my learning experience I have found that there comes a time that I simply need to scrap what I have done and start over with the more correct way of doing it. I have found that it is becomes pointless to continue on with what I have if what I have is more work to straighten out than it is to just start over again. Besides, trying to correct what you have isn't really going to teach you much since your logical approach is not the best way to handle this. If I am writing something and even though it may work some of the time and not work other times and I find that my whole approach is getting more and more complex and more and more complicated but still I just can't seem to get it to work I finally decide that it is time to look at some other appraoch. Most coding that I have learned I have learned from others who knew better ways than me. Why teach myself something the wrong way when someone else can teach me the right way even it it means throwing away what I have and get from them something that will teach me to understand better because their way is better and I really want to learn the better way than to keep fooling around with my own mess that I have made. Time is important and if I can get something done in a shorter time and not waste my time on something that I keep getting into blind spots then yes, give me the right way to do it, let me learn from it.

    I have no problem taking my code and making it work for your project which will explain to you more about how to handle gif files better than I could explain things to you and how to fix it in your current code since your current code is really not the way to parse a gif file.

    It's up to you. You can continue on fighting these problems with what you have or you can start learning the right way to handle gif logic.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  5. #205

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

    Re: [VB6] - animated gif function errors:(

    Quote Originally Posted by jmsrickland View Post
    Well, there are two ways to learn, the right way and the wrong way. In my learning experience I have found that there comes a time that I simply need to scrap what I have done and start over with the more correct way of doing it. I have found that it is becomes pointless to continue on with what I have if what I have is more work to straighten out than it is to just start over again. Besides, trying to correct what you have isn't really going to teach you much since your logical approach is not the best way to handle this. If I am writing something and even though it may work some of the time and not work other times and I find that my whole approach is getting more and more complex and more and more complicated but still I just can't seem to get it to work I finally decide that it is time to look at some other appraoch. Most coding that I have learned I have learned from others who knew better ways than me. Why teach myself something the wrong way when someone else can teach me the right way even it it means throwing away what I have and get from them something that will teach me to understand better because their way is better and I really want to learn the better way than to keep fooling around with my own mess that I have made. Time is important and if I can get something done in a shorter time and not waste my time on something that I keep getting into blind spots then yes, give me the right way to do it, let me learn from it.

    I have no problem taking my code and making it work for your project which will explain to you more about how to handle gif files better than I could explain things to you and how to fix it in your current code since your current code is really not the way to parse a gif file.

    It's up to you. You can continue on fighting these problems with what you have or you can start learning the right way to handle gif logic.
    i wan't learn the right way... the correct logic. but can you tell me how or show the code?
    (maybe, in time, i can avoid the temp files)
    VB6 2D Sprite control

    To live is difficult, but we do it.

  6. #206
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [VB6] - animated gif function errors:(

    Use below code for your modAniGif.bas module. I did not change you Form logic nor did I change your code logic for making the animation; I just gave you a correct way to parse a gif file. You will see that his works for 99.99% of all gif files (there's always those that don't conform to gif standards).

    I think once you have this you will get a better understanding of gif files and see why this is the correct way to do it.
    Attached Files Attached Files


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  7. #207

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

    Re: [VB6] - animated gif function errors:(

    Quote Originally Posted by jmsrickland View Post
    Use below code for your modAniGif.bas module. I did not change you Form logic nor did I change your code logic for making the animation; I just gave you a correct way to parse a gif file. You will see that his works for 99.99% of all gif files (there's always those that don't conform to gif standards).

    I think once you have this you will get a better understanding of gif files and see why this is the correct way to do it.
    thanks. i will test it.. thanks for all
    VB6 2D Sprite control

    To live is difficult, but we do it.

  8. #208
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [VB6] - animated gif function errors:(

    Here's some info

    It uses a byte array instead of a string

    Byte array is much faster than strings
    You use a pointer to the byte in the array, In string you use Mid() function which is much slower.
    A byte array is already in Ascii where a string is in Hex. Using a byte array you don't have to convert to Ascii

    It uses a Select Case to find the blocks. Your code used Instr() which is much slower.
    Your code scanned from one 21F9 to the next 21F9. Using the Select Case it picks up each block as it
    appears in the file and processes it. This guarantees you won't miss any blocks.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  9. #209

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

    Re: [VB6] - animated gif function errors:(

    Quote Originally Posted by jmsrickland View Post
    Here's some info

    It uses a byte array instead of a string

    Byte array is much faster than strings
    You use a pointer to the byte in the array, In string you use Mid() function which is much slower.
    A byte array is already in Ascii where a string is in Hex. Using a byte array you don't have to convert to Ascii

    It uses a Select Case to find the blocks. Your code used Instr() which is much slower.
    Your code scanned from one 21F9 to the next 21F9. Using the Select Case it picks up each block as it
    appears in the file and processes it. This guarantees you won't miss any blocks.
    if the instr() is much slow... then how can i test the 21F9... using a For...next?
    VB6 2D Sprite control

    To live is difficult, but we do it.

  10. #210
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [VB6] - animated gif function errors:(

    Why do you want to test the 21F9 using For...Next? If you you use the module code as I gave it to you there is no reason why you need to be concerned about testing 21F9...it's all done for you in the Select Case


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  11. #211

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

    Re: [VB6] - animated gif function errors:(

    Quote Originally Posted by jmsrickland;******5
    Why do you want to test the 21F9 using For...Next? If you you use the module code as I gave it to you there is no reason why you need to be concerned about testing 21F9...it's all done for you in the Select Case
    yes.. thanks.
    i see.. you use the selected case. and you use another loop for catch the block terminator frame. i must see more of your code. for correct my
    and the frames are showed normaly... all that i have(speaking on methods).
    thanks for all
    VB6 2D Sprite control

    To live is difficult, but we do it.

  12. #212
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [VB6] - animated gif function errors:(

    Quote Originally Posted by joaquim View Post
    yes.. thanks.
    i see.. you use the selected case. and you use another loop for catch the block terminator frame. i must see more of your code. for correct my
    and the frames are showed normaly... all that i have(speaking on methods).
    thanks for all
    Do you want me to send you the project from where I got the code I gave you yesterday?


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  13. #213

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

    Re: [VB6] - animated gif function errors:(

    Quote Originally Posted by jmsrickland View Post
    Do you want me to send you the project from where I got the code I gave you yesterday?
    if you don't mine
    thanks for all my friend
    (anotherthing what tutorial you used for learn how read animated gif files?)
    VB6 2D Sprite control

    To live is difficult, but we do it.

  14. #214
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [VB6] - animated gif function errors:(

    Here's a manual I learned from
    Attached Files Attached Files


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  15. #215

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

    Re: [VB6] - animated gif function errors:(

    Quote Originally Posted by jmsrickland View Post
    Here's a manual I learned from
    thanks
    VB6 2D Sprite control

    To live is difficult, but we do it.

  16. #216
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [VB6] - animated gif function errors:(

    I'll upload my project later so you can see how and what mine does.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  17. #217

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

    Re: [VB6] - animated gif function errors:(

    Quote Originally Posted by jmsrickland View Post
    I'll upload my project later so you can see how and what mine does.
    i did 1 test. and i can see the metter.gif sub images:
    Code:
    GifImageStart = Chr(33) '& Chr(249) '& Chr(4)
    but for other images don't works. but seems that ower error is in these line
    can you advice me?
    VB6 2D Sprite control

    To live is difficult, but we do it.

  18. #218
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [VB6] - animated gif function errors:(

    What do you mean for other images it doesn't work? I tested it with all of your images and it works. The only images that don't come out right are down, left, right, and up and that's because you are using black as the background and they are not supposed to be on black but the code I gave you works.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  19. #219

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

    Re: [VB6] - animated gif function errors:(

    Quote Originally Posted by jmsrickland View Post
    What do you mean for other images it doesn't work? I tested it with all of your images and it works. The only images that don't come out right are down, left, right, and up and that's because you are using black as the background and they are not supposed to be on black but the code I gave you works.
    i mean that sub that i builded(not what you change it)
    VB6 2D Sprite control

    To live is difficult, but we do it.

  20. #220
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [VB6] - animated gif function errors:(

    Quote Originally Posted by joaquim View Post
    i did 1 test. and i can see the metter.gif sub images:
    Code:
    GifImageStart = Chr(33) '& Chr(249) '& Chr(4)
    but for other images don't works. but seems that ower error is in these line
    can you advice me?
    There is no GifImageStart = Chr(33) in the code I gave you.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  21. #221
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [VB6] - animated gif function errors:(

    Well you need to make up your mind and tell me which module you are going to use. If you are not going to use the one I gave you then you are always going to have problems with yours and quite frankly I see no reason to fix it since it is wrong to begin with. If you test for just Chr(33) then you need to test the next byte as well and see if it is one of the ones that you need.
    Last edited by jmsrickland; Sep 20th, 2012 at 09:57 AM.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  22. #222

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

    Re: [VB6] - animated gif function errors:(

    Quote Originally Posted by jmsrickland View Post
    Well you need to make up your mind and tell me which module you are going to use. If you are not going to use the one I gave you then you are always going to have problems with yours and quite frankly I see no reason to fix it since it is wrong to begin with. If you test for just Chr(33) then you need to test the next byte as well and see if it is one of the ones that you need.
    i use it... but i'm trying to see why i can't see the meter on my own sub. that's why
    and i see that your pseudocode is diferent from mine and more cool
    VB6 2D Sprite control

    To live is difficult, but we do it.

  23. #223
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [VB6] - animated gif function errors:(

    You can't see the meter with your code because you capture the same image for all of your files. When you load the files back into your picturebox it's the same image, the first image, so all you see is the 1st image being played but they use the X and Y of the frames 2 - 67 and that is why it looks jitterly. Also, because you always have the same 1st frame your frame count is incorrect.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  24. #224

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

    Re: [VB6] - animated gif function errors:(

    Quote Originally Posted by jmsrickland View Post
    You can't see the meter with your code because you capture the same image for all of your files. When you load the files back into your picturebox it's the same image, the first image, so all you see is the 1st image being played but they use the X and Y of the frames 2 - 67 and that is why it looks jitterly. Also, because you always have the same 1st frame your frame count is incorrect.
    anotherthing that i need ask: for the real dimension, on control, we use the Gif dimension or frame dimension?
    and how we change the control size. i try: control.width=imagewidth. but seems not be correct. the form is in pixels, but do i need use the screen properties for these?
    VB6 2D Sprite control

    To live is difficult, but we do it.

  25. #225
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [VB6] - animated gif function errors:(

    Here's my project. I never finished it. The tabs are empty and the media control has no functionality. I decided to stop working on it and I went into a new version where the image is extracted out of the file and converted to a bitmap internally so it doesn't save and reload gif files like this version and yours does. Hope you like it.
    Attached Files Attached Files


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  26. #226

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

    Re: [VB6] - animated gif function errors:(

    Quote Originally Posted by jmsrickland View Post
    Here's my project. I never finished it. The tabs are empty and the media control has no functionality. I decided to stop working on it and I went into a new version where the image is extracted out of the file and converted to a bitmap internally so it doesn't save and reload gif files like this version and yours does. Hope you like it.
    vey cool.. thanks.
    you can see ball.gif without a problem... but my problem with these image is only the control size.
    how can i control the control size?
    (i'm speaking on last link(that is my sub updated by you))
    PS: please see these thread: http://www.vbforums.com/showthread.p...51#post4239151
    VB6 2D Sprite control

    To live is difficult, but we do it.

  27. #227
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [VB6] - animated gif function errors:(

    Quote Originally Posted by joaquim View Post
    vey cool.. thanks.
    you can see ball.gif without a problem... but my problem with these image is only the control size.
    how can i control the control size?
    (i'm speaking on last link(that is my sub updated by you))
    PS: please see these thread: http://www.vbforums.com/showthread.p...51#post4239151
    I'm not sure I understand. What is control size?

    The link to your post at the other thread....you save updated by me????? I don't think so.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  28. #228

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

    Re: [VB6] - animated gif function errors:(

    Quote Originally Posted by jmsrickland View Post
    I'm not sure I understand. What is control size?

    The link to your post at the other thread....you save updated by me????? I don't think so.
    sorry... on post #206. that code, with ball.gif, don't give me with right Width size. that's why i can't see the ball
    VB6 2D Sprite control

    To live is difficult, but we do it.

  29. #229
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [VB6] - animated gif function errors:(

    There are two ball gif files, ball1 and ball2 and they both look OK to me. I see that ball1 touches the edges of the picturebox but it does the same thing in my application (the one I just posted) so what is it that makes you think the width is incorrect?


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  30. #230

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

    Re: [VB6] - animated gif function errors:(

    Quote Originally Posted by jmsrickland View Post
    There are two ball gif files, ball1 and ball2 and they both look OK to me. I see that ball1 touches the edges of the picturebox but it does the same thing in my application (the one I just posted) so what is it that makes you think the width is incorrect?
    because i have test it
    change the autosize to false and resize the control to more big and you see what i'm saying
    my problem is use the big size of frame and continue with autosize true
    VB6 2D Sprite control

    To live is difficult, but we do it.

  31. #231
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [VB6] - animated gif function errors:(

    It still looks OK after I change to AutoSize = False and make it bigger. It's the same size image inside a bigger box which is exactly what should be expected.

    Now do you want to make the Picturebox bigger, have it AutoSize = True and have the ball image be bigger?
    Last edited by jmsrickland; Sep 20th, 2012 at 03:34 PM.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  32. #232

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

    Re: [VB6] - animated gif function errors:(

    Quote Originally Posted by jmsrickland View Post
    It still looks OK after I change to AutoSize = False and make it bigger. It's the same size image inside a bigger box which is exactly what should be expected.

    Now do you want to make the box bigger, AutoSize = True and have the ball image be bigger?
    1 thing is the frame size and other is the gif size, right?
    then what i want is use the AutoSize = True, but with gif size
    VB6 2D Sprite control

    To live is difficult, but we do it.

  33. #233
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [VB6] - animated gif function errors:(

    Quote Originally Posted by joaquim View Post
    1 thing is the frame size and other is the gif size, right?
    then what i want is use the AutoSize = True, but with gif size
    You use AutoSize = True if you want the Picturebox to be the same as the gif image size which is what you have been doing.

    If you want the image to stay at gif size but you want the Picturebox to be bigger then you set AutoSize = False and then you should center the gif image in the Picturebox otherwise it will be positioned at the upper left corner.

    I don't know what any of this has to do with you saying that the ball width is wrong. I tested both ball1 and ball2 and I see nothing wrong with them.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  34. #234

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

    Re: [VB6] - animated gif function errors:(

    Quote Originally Posted by jmsrickland View Post
    You use AutoSize = True if you want the Picturebox to be the same as the gif image size which is what you have been doing.

    If you want the image to stay at gif size but you want the Picturebox to be bigger then you set AutoSize = False and then you should center the gif image in the Picturebox otherwise it will be positioned at the upper left corner.

    I don't know what any of this has to do with you saying that the ball width is wrong. I tested both ball1 and ball2 and I see nothing wrong with them.
    sorry i mean ball.gif file.
    use the attachment file for see what i mean. for my Sprite2D isn't a problem because i can control the autosize manualy hehehe
    but for another application can be a problem.
    (do you want see my Sprite2D?)
    thanks for all
    Attached Images Attached Images  
    VB6 2D Sprite control

    To live is difficult, but we do it.

  35. #235
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [VB6] - animated gif function errors:(

    Quote Originally Posted by joaquim View Post
    sorry i mean ball.gif file.
    use the attachment file for see what i mean. for my Sprite2D isn't a problem because i can control the autosize manualy hehehe
    but for another application can be a problem.
    (do you want see my Sprite2D?)
    thanks for all

    Yes, I would like very much to see your Sprite2D project.
    Last edited by jmsrickland; Sep 21st, 2012 at 11:28 AM.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  36. #236
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [VB6] - animated gif function errors:(

    I see what you mean. Your picturebox should be long but it appears to be the size of a single ball. I will see what I can do to figure out what is going on here.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  37. #237
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [VB6] - animated gif function errors:(

    I see what you mean. Your picturebox should be long but it appears to be the size of a single ball. I will see what I can do to figure out what is going on here.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  38. #238
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [VB6] - animated gif function errors:(

    OK, I believe if you add the following code (red) to your project it will correct the ball.gif problem or any other gif that does the same thing.

    Code:
    Public Function LoadGifFile(strFileName As String, aimg As Variant) As Long
      '
      '
      '
     Do
       '
       ' load an image\picture control if the index is more than 0(zero)
       '
       If I > 0 Then
         Load aimg(I)
       End If
       
       If I = 0 Then
         aimg(I).Width = LSD.GifWidth + 4
         aimg(I).Height = LSD.GifHeight + 4
         aimg(I).AutoSize = False
       Else
         aimg(I).AutoSize = True
       End If
       
       '
       ' Now change the backcolor and load the image
       '
       aimg(I).Picture = LoadPicture(App.Path & "\GifPicture(" & I & ").gif")
    
       If GCE(I + 1).TransparentFlag <> 0 Then
         aimg(I).BackColor = GCE(I + 1).TransparentFlag  '<-- TransparentFlag is not a transparent color
       Else
         aimg(I).BackColor = GetPixel(aimg(I).hdc, 0, 0) '<-- Why don't you use the real background color?
       End If
      
       If aimg(I).BackColor = 1 And GCE(I + 1).Disposal = 2 Then aimg(I).BackColor = vbWhite
            
       aimg(I).Picture = LoadPicture(App.Path & "\GifPicture(" & I & ").gif")
      '
      '
      '
    End Function


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  39. #239

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

    Re: [VB6] - animated gif function errors:(

    Quote Originally Posted by jmsrickland View Post
    OK, I believe if you add the following code (red) to your project it will correct the ball.gif problem or any other gif that does the same thing.

    Code:
    Public Function LoadGifFile(strFileName As String, aimg As Variant) As Long
      '
      '
      '
     Do
       '
       ' load an image\picture control if the index is more than 0(zero)
       '
       If I > 0 Then
         Load aimg(I)
       End If
       
       If I = 0 Then
         aimg(I).Width = LSD.GifWidth + 4
         aimg(I).Height = LSD.GifHeight + 4
         aimg(I).AutoSize = False
       Else
         aimg(I).AutoSize = True
       End If
       
       '
       ' Now change the backcolor and load the image
       '
       aimg(I).Picture = LoadPicture(App.Path & "\GifPicture(" & I & ").gif")
    
       If GCE(I + 1).TransparentFlag <> 0 Then
         aimg(I).BackColor = GCE(I + 1).TransparentFlag  '<-- TransparentFlag is not a transparent color
       Else
         aimg(I).BackColor = GetPixel(aimg(I).hdc, 0, 0) '<-- Why don't you use the real background color?
       End If
      
       If aimg(I).BackColor = 1 And GCE(I + 1).Disposal = 2 Then aimg(I).BackColor = vbWhite
            
       aimg(I).Picture = LoadPicture(App.Path & "\GifPicture(" & I & ").gif")
      '
      '
      '
    End Function
    yes.. thanks... now i must do the same on my Sprite control.
    let me ask 1 thing... when you need change a control, normaly, you use the screen properties?
    VB6 2D Sprite control

    To live is difficult, but we do it.

  40. #240

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

    Re: [VB6] - animated gif function errors:(

    hehehe
    now works fine
    thanks
    Code:
    UserControl.Width = GifWidth * Screen.TwipsPerPixelX + IFF(UserControl.BorderStyle = 1, 4, 0) * Screen.TwipsPerPixelX
                    UserControl.Height = GifHeight * Screen.TwipsPerPixelY + IFF(UserControl.BorderStyle = 1, 4, 0) * Screen.TwipsPerPixelY
    and from anigif code for show static gif images isn't correct:
    Code:
    If lFrameCount = 0 Then
       aimg(0).Picture = LoadPicture(App.Path & "\GifPicture(0).gif")
       aimg(0).BackColor = GetPixel(aimg(0).hDC, 0, 0)
       LoadGifFile = 1
       Kill App.Path & "\GifPicture(0).gif"
       Exit Function
     End If
    you did with '1', but gives me a size problem, then i change it to '0' and works fine
    Last edited by joaquim; Sep 21st, 2012 at 01:20 PM.
    VB6 2D Sprite control

    To live is difficult, but we do it.

Page 6 of 7 FirstFirst ... 34567 LastLast

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