Picture Box in Visual Basic 6.0


PictureBox control is  the most powerful and complex items in the Visual Basic .The picture box is  one of the controls that used to handle graphics.you can load a picture at design phase by clicking on the picture item in the properties window and select the picture from the selected folder .You can also load the picture at runtime using the LoadPicture metoh.For example,the statement will load the picture “abc.jpg” into the picture box.

1. Start -> program-> Microsoft Visual Studio 6.0 -> Microsoft Visual Basic 6.0
2. Visual Basic load and appears on your screen.
3. Choose Standard Exe. From dialog box.
4. Add Picture1 control  and four Button command1,command2,command3,command4 from the toolbox on the form.
5. Set the caption property of command1(down),command2(top),command3(right),command4(left).

6.Click on code window from project window.code window is open select the object one by one from the object window and write the code here as shown in figure.

7.When the codding is complete then you run the program .
8. To run the program press <f5>.output is:

9. When you click on top button picture move on top,if click on down picture move in down ,if click on left picture move in left,if click on right picture move in right.

Comments are closed.