-
January 7th, 2013, 11:59 AM
#16
Re: [VB6] - pointers and bitmaps
Originally Posted by WizBang
OK, I've looked over your class file. Although unfamiliar with your particular programming style, I can see many things which could be improved. For instance, you have some Do...Loops, and within the loops there is an If Then Else. This is a case where you could use Do Until or Do While. Also, there is a set of If Then statements within the ChangeImage sub which all have one condition in common. So in this case you could nest these inside one If Then for that common condition rather than test it for each one separately.
Incidentally, you can draw directly onto the surface of the UserControl, so it if often unnecessary to use a separate PictureBox. Even so, passing it as an Object is slower than passing it as a PictureBox.
However, changing a color in an image pixel by pixel is always very slow compared to using the same technique as for transparency. That's what I'd recommend. Rotating an image is of course another matter, but that's not likely to be what's slowing down the loading of the form.
but when i used DC instead DIB's, the form didn't take so many time to open
or theres something that i forget. or i need put the doevents in my ShowImage sub, in my 2D Sprite
-
January 7th, 2013, 12:19 PM
#17
Re: [VB6] - pointers and bitmaps
Originally Posted by Cambalinho
but when i used DC instead DIB's, the form didn't take so many time to open
or theres something that i forget. or i need put the doevents in my ShowImage sub, in my 2D Sprite
Please clarify what you mean about the DC and DIBs.
Having a PictureBox in each Sprite control will slow things down too. The fewer resources you can use, the better you can optimize for speed.
If you want the form to show first, before the sprites, there are a few ways to do it. Using DoEvents is often unnecessary, and can further slow things down. In the Form_Load event, you can use Me.Show, then enable the sprites. Another way involves using the Show, Paint, and Resize subs of the UserControl, as these fire under certain specific conditions.
Please remember to rate the posts and threads that you find useful.
How can something be both new and improved at the same time?
-
January 7th, 2013, 02:16 PM
#18
Re: [VB6] - pointers and bitmaps
Originally Posted by WizBang
Please clarify what you mean about the DC and DIBs.
Having a PictureBox in each Sprite control will slow things down too. The fewer resources you can use, the better you can optimize for speed.
If you want the form to show first, before the sprites, there are a few ways to do it. Using DoEvents is often unnecessary, and can further slow things down. In the Form_Load event, you can use Me.Show, then enable the sprites. Another way involves using the Show, Paint, and Resize subs of the UserControl, as these fire under certain specific conditions.
try download these and test it... the big thing is in ShowImage() sub and the FileName property inside of usercontrol: http://www.mediafire.com/?fboiopjowtnjzb0 (sorry about dll's and other files)
theres the mdlGraphics where i have the graphics in DC, the DIB class and others.
and these: http://cambalinho.blogspot.pt/2009/07/2d-sprite.html
gives you the information about my control
what i need is that you just see something, don't lose very time. and tell me what you think. thanks for all
-
January 8th, 2013, 04:55 AM
#19
Re: [VB6] - pointers and bitmaps
Originally Posted by WizBang
OK, I've looked over your class file. Although unfamiliar with your particular programming style, I can see many things which could be improved. For instance, you have some Do...Loops, and within the loops there is an If Then Else. This is a case where you could use Do Until or Do While. Also, there is a set of If Then statements within the ChangeImage sub which all have one condition in common. So in this case you could nest these inside one If Then for that common condition rather than test it for each one separately.
Incidentally, you can draw directly onto the surface of the UserControl, so it if often unnecessary to use a separate PictureBox. Even so, passing it as an Object is slower than passing it as a PictureBox.
However, changing a color in an image pixel by pixel is always very slow compared to using the same technique as for transparency. That's what I'd recommend. Rotating an image is of course another matter, but that's not likely to be what's slowing down the loading of the form.
finally i did find and resolve 1 problem in my control. my control enter in showimage()(for do effects and draw the image) 9 times. imagine 10 sprites in form... wow... it's takes time for show the form. but i resolve it, and now the form opens. at least don't takes 1 minute lol
thanks for all my friend... thanks
i will try see better my DIB's class for win more speed.... but i accept more advices
what you do for 'close' the thread? or there isn't any option for it?
Last edited by Cambalinho; January 8th, 2013 at 04:58 AM.
-
January 8th, 2013, 09:17 AM
#20
Re: [VB6] - pointers and bitmaps
I'm glad you found and resolved an issue. If you feel the thread is resolved, use the Thread Tools to mark is so.
Please remember to rate the posts and threads that you find useful.
How can something be both new and improved at the same time?
-
January 8th, 2013, 09:22 AM
#21
Re: [VB6] - pointers and bitmaps
Originally Posted by WizBang
I'm glad you found and resolved an issue. If you feel the thread is resolved, use the Thread Tools to mark is so.
finally i found it lol
thanks for all, i rate you
thanks for all my friend
Last edited by Cambalinho; January 8th, 2013 at 09:29 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|