Some experiences in vbprogramming

Source: Internet
Author: User
Tags bmp image

Some experiences in vbprogramming

The subject of graduation design in university is to compile a teaching software, so it is natural
The easy-to-learn, easy-to-understand, user-friendly and beautiful language of VB has been dealt. In
Of course we encountered many problems in the process. Here we will write down some simple small programs.
Share with friends who love programming.
I. Cover
The design of the cover is like this. First, a form is displayed with your favorite pattern on it. However
Then a ship was running from left to right. At the top of the screen,
Welcome.
The specific method is to load the pre-selected background pattern into the cover form.
The body is named Cai. Then, install the pre-created image in the three image controls.
The bitmap "Huan", "Welcoming", and the ship type pattern. Then place the three images in the initial
Position (that is, the position of the pattern when the form appears), and set their visual attributes
Set it to "false ". The procedure is as follows:
Sub form_load ()
Cai. Show 'show cover form
Dim I 'defines Variables
Image3.visible = true' the image control of the ship type appears.
A1: If image3.left <6120 then' 6120 is the coordinate of the ship moving to the right of the screen. You can select image3.move image3.left + 50' as needed to move the image control slowly, you can change the Moving Value goto A1 end if image1.visible = "true" '"Huan" to A2: if image1.left <2120 then' 2120 is the place where the word "Huan" is moved to the center of the screen image1.move image1.lefe + 50' move this image control goto A2 end if image2.visible = "true" 'Welcome "a3: if image2.left> 5420 then
'2018010' indicates the position in the middle of the screen
Image2.move image2.left-50 'Move this image control
Goto A3
End if
For 1 to 10000
'To suspend the form for a period of time can be achieved by changing the number of cycles
Next I
Menul. Show 'show main program form
Unload Cai 'unload cover form
End sub
2. Simple "Animation"
After clicking a 3D button, the screen shows that the light goes parallel to a glass tube, and there is
Scattering Center. Some light emits at this center and then returns to the initial end of the tube. The procedure is as follows:
Sub command3dl_click ()
Dim I, J, K, M, n' defines Variables
For I = 2080 to 5520.
'Three lines are displayed until the scattering center in the image is black.
Line (2080,2760)-(I, 2760), RGB (0, 0, 0)
Line (2860,)-(I,), RGB (0, 0, 0)
Line (2660,)-(I,), RGB (0, 0, 0)
Next I
For J = 5520 to 4800 step-1 'reflection light first shot on the tube wall
Line (5520,2760)-(J, 2760-(5520-j) *. 33333333), RGB
(255, 0, 0) 'reflection light, the color is red
Line (5520,2660)-(5520 + (5520-j), 2660), RGB (0, 0, 0)
Line (5520,2860)-(5520 + (5520-j), 2860), RGB (0, 0, 0)
'The two light rays in the scattering center are not met. The light is black and continues.
Next J
For k = 4800 to 3360 step-1 'reflection light second shot to tube wall
Line (2520)-(K, 33333333 + (4800-k ),
RGB (255, 0, 0) 'reflection light, color red
Line (6240, 2660)-(+ (4800-k),), RGB (0, 0, 0)
Line (6240, 2860)-(+ (4800-k),), RGB (0, 0, 0)
'The two light rays in the scattering center are not met, and the color is black.
Next K
For M = 3360 to 2080 step-1 'reflection light shot to the tube wall for the third time
Line (3363000)-(M, 33333333-(3360-m ),
RGB (255, 0, 0) 'reflection light, color red
Next m
End sub
Iii. Back Cover
The back cover is designed to show a full black screen first, and then pull the white background from top to bottom
The red letter "goodbye. First, create a BMP image in the canvas as required.
"Goodbye ". Then add a full-screen large
Picturel: load the BMP graph. The procedure is as follows:
Sub form_load ()
Dim I 'defines Variables
Bye. Show appears
Unload menu1' unmount the main menu
AL: If picture1.height <7130 then' 7130 indicates the Image Height picturel. height = "picture1.height + 50" 'drop-down screen goto Al end if for I = "1" to 100' causes the form to pause for a period of time. Next I end' ends all operations. End sub-groups

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.