Good Lord. I'm sorry if I was initially brusque, but really, I'm now speechless.
First of all, I am aware that .NET introduces 'new ways to program' for people using VB, in that proper programming practices such as OO suddenly have become available to you. But, a picture box is still a picture box. And, if you know how to do the limited sort of stuff that is possible in creating transitions using picture boxes, why did you ask No 'new way to program' will change this, excepting the possibility that VB6 didn't let you inherit a class from the picture box control.
To do transitions, you have two options. First, you can keep using the approach you've used in the past, of moving two or three picture boxes on top of each other. Can I note at this point that you didn't ask about this, you asked about using *a* picture box. You cannot create a transition in a picture box, at least not without it being a waste of time ( do the transition outside the picture box and keep throwing bitmaps at the picture box ).
Or, you can write some actual code that does transitions, making a whole slew of things possible that are not possible by setting the co-ordinates of picture boxes.
If you want the former, you already knew how it was done. It's a hack, IMO, but it works. If you want the latter, then my answer remains correct, as at least one other person has noted. No matter how many picture boxes you create, you cannot do a diagonal slide, or a transition that replaces pixels at random, for example. If you want to be able to do any sort of transition you like, then you need to write the code yourself. Even if you use picture boxes, you still need to write the code yourself, your just not going to be able to do very much.
Chris must not have gotten what he wanted for Christmas, he's been grumpy ;)
The nice thing about .NET Zdrae is that it is easy to inherit methods and properties. If you design your own code to wipe a picturebox from top to bottom, left to right, etc. it is not a great leap to create your own picture box control that has it's own new properties and methods (e.g. PictureNew property to store the 2nd picture, and a .Wipe method that draws the new picture creatively) in addition to all the properties and methods of a standard picturebox.
If you'd like help with a specific code idea (e.g. how to draw one picture on top of another, or perhaps a routine to do a diagonal draw, etc.) then please ask specifics, I'm sure there are plenty of folks here who can help with the GDI steps.
Yes, I do know how to use pictureboxes in transition including: the 360 slide, the running man and windowing.... but it's all VB6. However, net introduces new ways to program and I was looking to learn what's possible with the power of .net instead of using APIs.
Yes it's quite awkward doing stuff like this for years and then having someone say it can't be done.
It's incredible how many people mistake the picturebox control for a paint program, or for Powerpoint.
You can't. A picture box is there so you can show a picture without writing the two lines of code required. If you want to do more, you'll need a lot more than those two lines, you'll need to write these sort of transitions for yourself.
The easiest possible transition would be just to replace one picture with another in blocks. The best way to do that is probably to create an array of rectangles, which between them represent the entire image. Then put them in an arraylist and shuffle it. Then you can iterate through it, drawing the new bitmap over the old one, a rectangle at a time, in random order.
Obviously, you'd need to manage the Bitmap yourself. It's easiest if you also draw it yourself, outside the picture box. Then you can use Graphics.FromBitmap to get a graphics object for the destination image, and DrawImage to draw sections of the source image over it.
To center my point about VB6 to net... let me explain one of the problems that occur doing certain transition. If I'm doing a slide, one image is already center stage and another image is off stage (say, to the left or right). To change image, you slide the PB to center stage (or slide exiting image off stage to reveal the next image).
This is fine except for one small (or big) detail; while the picture is in transition, it's not very easy on the eyes (doesn't repaint fast enough). This is even common on some DVD movies when they pan or zoom. But I think I've seen some slideshows that slide images without that blurry feeling.
To this end, my idea of thinking is that with newer technology (.net) comes better quality and features; the older problems having been solved. VB6 may still be good but it was made years ago. Actually, I didn't like .net at first. I was thinking it was more work and more complicated. Why learn something new (new bugs) when you can reuse VB6 code... it's proven, it works and you don't have to rewrite it.
It looks like it creates exactly what we were talking about, in an older version of .Net (it converts to '05 fine). It's not in English, but I think you will be able to follow what it is doing.
Yes, that's because the picture box is not designed to be moved like that, and it's very existence adds overhead. And yes, Windows Forms have a double buffer mode that gets rid of the flicker, when you draw the bitmaps yourself. So, you're right, that's one way in which the new framework helps you.
I can imagine how much of a change VB.NET was for you, but I think in the long run, you'll start to wonder how you ever survived without the sort of features that VB.NET offers over VB6.
Yes, you can indeed use two picture boxes to create any sort of transition that doesn't involve anything more than an image growing in size on top of another one, in a purely rectangular way. And what does this tell you That a picture box cannot handle transitions, but you can create your own, by writing code. The transitions you can create by using picture boxes are extremely limited, as you've discovered.
So, it would appear you knew the answer to the question, and asked anyhow. A picture box cannot handle the vast majority of transitions you're likely to see in a program like powerpoint. My answer is correct, you just have to learn to live with it.
Seriously, I apologise for being gruff, it was my first day back, I'd answered three similar questions already, and I was just wondering why so many people think the picture box does more than show pictures.
I have a series of articles on image processing on www.codeproject.com, they are in C#, but the GDI+ code obviously all ports to VB directly. They show how to directly access the pixels in an image, which would be the way to go for a lot of transforms.
I would concur - writing a new control that does these transitions derived from a picture box would be a really useful thing. If you do it, I'd encourage you to consider making it an article on the site I mentioned above. They take VB articles nowadays.
What we have here.... is a failure to communicate!
It's amazing how many people think that they are actually qualified to answer questions they can't.
This is the Visual Basic "LANGUAGE" section... not the Visual Basic MIRACLE Controls section. If the Picturebox by itself could do transitions, transitions would be in the properties box. It's not. We all know that.
But using VB Code, it is possible. I've seen transparent and odd shape forms and controls using VB5,6. Even though it was not possible without being in the "know".
In fact, I can do several transitions with the picturebox... I can use two picturebox one behind the other preloaded with pictures. I can shrink the front one smaller revealing the other, then hide the tiny image.
Then I can also load a third image into the hidden picturebox, show it and then enlarge it to cover the back image.
How to make slideshow transition with Picturebox
Draakje
Good Lord. I'm sorry if I was initially brusque, but really, I'm now speechless.
First of all, I am aware that .NET introduces 'new ways to program' for people using VB, in that proper programming practices such as OO suddenly have become available to you. But, a picture box is still a picture box. And, if you know how to do the limited sort of stuff that is possible in creating transitions using picture boxes, why did you ask No 'new way to program' will change this, excepting the possibility that VB6 didn't let you inherit a class from the picture box control.
To do transitions, you have two options. First, you can keep using the approach you've used in the past, of moving two or three picture boxes on top of each other. Can I note at this point that you didn't ask about this, you asked about using *a* picture box. You cannot create a transition in a picture box, at least not without it being a waste of time ( do the transition outside the picture box and keep throwing bitmaps at the picture box ).
Or, you can write some actual code that does transitions, making a whole slew of things possible that are not possible by setting the co-ordinates of picture boxes.
If you want the former, you already knew how it was done. It's a hack, IMO, but it works. If you want the latter, then my answer remains correct, as at least one other person has noted. No matter how many picture boxes you create, you cannot do a diagonal slide, or a transition that replaces pixels at random, for example. If you want to be able to do any sort of transition you like, then you need to write the code yourself. Even if you use picture boxes, you still need to write the code yourself, your just not going to be able to do very much.
pedron
Chris must not have gotten what he wanted for Christmas, he's been grumpy ;)
The nice thing about .NET Zdrae is that it is easy to inherit methods and properties. If you design your own code to wipe a picturebox from top to bottom, left to right, etc. it is not a great leap to create your own picture box control that has it's own new properties and methods (e.g. PictureNew property to store the 2nd picture, and a .Wipe method that draws the new picture creatively) in addition to all the properties and methods of a standard picturebox.
If you'd like help with a specific code idea (e.g. how to draw one picture on top of another, or perhaps a routine to do a diagonal draw, etc.) then please ask specifics, I'm sure there are plenty of folks here who can help with the GDI steps.
Jaie Wilson
Yes, I do know how to use pictureboxes in transition including: the 360 slide, the running man and windowing.... but it's all VB6. However, net introduces new ways to program and I was looking to learn what's possible with the power of .net instead of using APIs.
Yes it's quite awkward doing stuff like this for years and then having someone say it can't be done.
Keith Lai
It's incredible how many people mistake the picturebox control for a paint program, or for Powerpoint.
You can't. A picture box is there so you can show a picture without writing the two lines of code required. If you want to do more, you'll need a lot more than those two lines, you'll need to write these sort of transitions for yourself.
John Padilla
The easiest possible transition would be just to replace one picture with another in blocks. The best way to do that is probably to create an array of rectangles, which between them represent the entire image. Then put them in an arraylist and shuffle it. Then you can iterate through it, drawing the new bitmap over the old one, a rectangle at a time, in random order.
Obviously, you'd need to manage the Bitmap yourself. It's easiest if you also draw it yourself, outside the picture box. Then you can use Graphics.FromBitmap to get a graphics object for the destination image, and DrawImage to draw sections of the source image over it.
Florin Lazar
Flipping images is easy. Using transition makes it a lot more fun and entertaining. And I like the idea of a Wipe method sounds great.
Perhaps we could start with Drawing a Picture over another
Thanks
Mark Richter
Thanks... I will certainly take look at it.
To center my point about VB6 to net... let me explain one of the problems that occur doing certain transition. If I'm doing a slide, one image is already center stage and another image is off stage (say, to the left or right). To change image, you slide the PB to center stage (or slide exiting image off stage to reveal the next image).
This is fine except for one small (or big) detail; while the picture is in transition, it's not very easy on the eyes (doesn't repaint fast enough). This is even common on some DVD movies when they pan or zoom. But I think I've seen some slideshows that slide images without that blurry feeling.
To this end, my idea of thinking is that with newer technology (.net) comes better quality and features; the older problems having been solved. VB6 may still be good but it was made years ago. Actually, I didn't like .net at first. I was thinking it was more work and more complicated. Why learn something new (new bugs) when you can reuse VB6 code... it's proven, it works and you don't have to rewrite it.
Thesp
You might study the code at:
http://planetsourcecode.com/vb/scripts/ShowCode.asp txtCodeId=3082&lngWId=10
It looks like it creates exactly what we were talking about, in an older version of .Net (it converts to '05 fine). It's not in English, but I think you will be able to follow what it is doing.
Amar_k_solai
Great Movie, But you will get a lot better response Captian if don't treat everyone like Luke!
GLK Enterprises
Yes, that's because the picture box is not designed to be moved like that, and it's very existence adds overhead. And yes, Windows Forms have a double buffer mode that gets rid of the flicker, when you draw the bitmaps yourself. So, you're right, that's one way in which the new framework helps you.
I can imagine how much of a change VB.NET was for you, but I think in the long run, you'll start to wonder how you ever survived without the sort of features that VB.NET offers over VB6.
Niko Vrdoljak
Yes, you can indeed use two picture boxes to create any sort of transition that doesn't involve anything more than an image growing in size on top of another one, in a purely rectangular way. And what does this tell you That a picture box cannot handle transitions, but you can create your own, by writing code. The transitions you can create by using picture boxes are extremely limited, as you've discovered.
So, it would appear you knew the answer to the question, and asked anyhow. A picture box cannot handle the vast majority of transitions you're likely to see in a program like powerpoint. My answer is correct, you just have to learn to live with it.
virtually
Actually, I don't know what the movie is, but I know the quote from a Guns n Roses song :-)
Graham Laidler
I NEVER get what I want for Xmas :-)
Seriously, I apologise for being gruff, it was my first day back, I'd answered three similar questions already, and I was just wondering why so many people think the picture box does more than show pictures.
I have a series of articles on image processing on www.codeproject.com, they are in C#, but the GDI+ code obviously all ports to VB directly. They show how to directly access the pixels in an image, which would be the way to go for a lot of transforms.
I would concur - writing a new control that does these transitions derived from a picture box would be a really useful thing. If you do it, I'd encourage you to consider making it an article on the site I mentioned above. They take VB articles nowadays.
mabraham1
What we have here.... is a failure to communicate!
It's amazing how many people think that they are actually qualified to answer questions they can't.
This is the Visual Basic "LANGUAGE" section... not the Visual Basic MIRACLE Controls section. If the Picturebox by itself could do transitions, transitions would be in the properties box. It's not. We all know that.
But using VB Code, it is possible. I've seen transparent and odd shape forms and controls using VB5,6. Even though it was not possible without being in the "know".
In fact, I can do several transitions with the picturebox... I can use two picturebox one behind the other preloaded with pictures. I can shrink the front one smaller revealing the other, then hide the tiny image.
Then I can also load a third image into the hidden picturebox, show it and then enlarge it to cover the back image.
Now, there's a couple of transitions for YA C++.