PictureData Property

Applies To

Command Button Control, Form, Image Control, Report, Toggle Button Control.

Description

You can use the PictureData property in Visual Basic to copy the picture in one form, report, or control to another object that supports the Picture property.

Setting

The PictureData property setting is the PictureData property of another image control, command button, toggle button, form, or report.

You set this property using Visual Basic.

Remarks

You can use this property to open a form using a different background picture, depending on actions taken by the user. For example, you might open a Customers form using a different background picture depending on whether the form is opened for data entry or for browsing.

You can also use the PictureData property together with the Timer event and the TimerInterval property to perform simple animation on a form.

See Also

Picture Property, PictureAlignment Property, PicturePages Property, PictureSizeMode Property, PictureTiling Property, PictureType Property.

Example

The following example uses three image controls to animate a butterfly image across a form. The Hidden1 image control contains a picture of a butterfly with its wings up and the Hidden2 image control contains a picture of the same butterfly with its wings down. Both image controls have their Visible property set to False. The TimerInterval property is set to 200. Each time the Timer event occurs, the picture in the image control Visible1 is changed using the PictureData property of the hidden image controls, and the visible image control is moved 200 twips to the right. The visible image control is moved back to the left side of the form when its Left property value is greater than the width of the form stored in the global variable gfrmWidth. The value of gfrmWidth is set to Me.Width in the form’s open event.


Private Sub Form_Timer()
    Static picNum As Integer
    Select Case picNum
        Case Is = 1
            Me!Visible1.PictureData = Me!Hidden1.PictureData
        Case Is = 2
            Me!Visible1.PictureData = Me!Hidden2.PictureData
        Case Else
    End Select
    If picNum = 2 Then picNum = 0
    picNum = picNum + 1
    If (Me!Visible1.Left > gfrmWidth) Then Me!Visible1.Left = 0
    Me!Visible1.Left = Me!Visible1.Left + 200Sub