VB Summary. 2

Objects and object names

For example: create a control array of image1 , img1 (0) , img1 (1) , img1 (2) will appear ...

If I change them to img1 , img2 , img3 ..., or img10 , img11 , img12 ...,

Nothing can be knocked into the code. But written as img1 ( 0 ), img2 ( 1 ), img3 ( 2 ) ......,

Or img10 ( 0 ), img11 ( 1 ), img12 ( 2 ) ..., you can succeed.

What succeeds is the object, and what fails is just an object name.

 

 

Method for loading pictures in program running stage

 

1. Step by step

Image1 / Picture1.picture = LoadPicture ("D: \ picture \ picture name ")

 

2. First store the picture in the save path of the program

Image1 / Picture1.picture = LoadPicture (App.Path & " picture name ")

 

 

The difference between Image and PictureBox

 

(1) The image frame is suitable for static images and does not have a drawing function; the picture frame has drawing attributes and graphic methods ( Print , Line , Circle , Cls ) that are not available in the image frame control .

(2) The picture frame has a container function; the image frame does not.

   
(3) The
image frame has the Stretch property, which can change the aspect ratio of the image in the image control; and the image ratio in the picture frame cannot be changed.


(4) The
picture frame has the AutoSize property; the image frame does not.


(5) The
picture frame has the AutoRedraw attribute, which determines whether to redraw the graphics generated by the graphics method, but the image frame does not. The default value of the AutoRedraw property of the picture frame is False . At this time, the graphics generated by the graphics method are temporary graphics. Temporary graphics can be erased after being covered by other forms, or can be erased using the Cls method. The graphics cannot be recovered after the form becomes smaller or hidden. After the AutoRedraw property is set to Ture , the graphics or text generated by the graphics method are persistent graphics. Persistent graphics can be automatically redrawn and output in the above situations, and can not be erased by the Cls method. To erase the persistent graphics, you need to reset the BackColor property.

 

Published 18 original articles · won praise 1 · views 5881

Guess you like

Origin blog.csdn.net/qq844838587/article/details/73345230