Table of contents
TOC
折叠目录
展开目录

ToggleButton.PictureData 属性 (访问)ToggleButton.PictureData Property (Access)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

可以使用PictureData属性以将图片复制到另一个支持图片属性的对象。读/写variant 类型的值You can use the PictureData property to copy the picture to another object that supports the Picture property. Read/write Variant.

语法Syntax

表达式PictureDataexpression. PictureData

表达式_一个表示一个切换按钮对象的变量。_expression A variable that represents a ToggleButton object.

注解Remarks

PictureData属性设置为另一个控件、 窗体或报表的PictureData属性。The PictureData property setting is the PictureData property of another control, form, or report.

使用该属性可以根据用户所执行的操作的不同,在窗体中显示不同的背景图片。例如,可以根据“客户”窗体打开的目的是输入数据还是浏览数据而在打开窗体时使用不同的背景图片。You can use this property to display different background pictures in a form, 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.

您可以使用PictureData属性和计时器事件,并将TimerInterval属性在窗体上执行简单的动画。You can also use the PictureData property together with the Timer event and the TimerInterval property to perform simple animation on a form.

示例Example

下面的示例使用三个图像控件进行动画蝴蝶图像处理窗体中飞过。Hidden1 图像控件包含的图片: 一只蝴蝶翅向上和 Hidden2 图像控件包含图片的蝴蝶翅膀向下。这两个图像控件都有其可见性属性设置为FalseTimerInterval属性设置为 200。每次计时器事件时,通过使用隐藏的图像控件的PictureData属性更改 1> 图像控件中的图片,可见图像控件向右移动 200 缇。可见图像控件将移回窗体的左边缘时其属性值大于公共变量中存储的窗体宽度gfrmWidth。值gfrmWidth设置为Me.Width在该窗体的 open 事件中。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 by 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 public variable gfrmWidth. The value of gfrmWidth is set to Me.Width in the form's open event.

Private Sub Form_Timer() 

 Static intPic As Integer 

 Select Case intPic 
 Case Is = 1 
 Me!Visible1.PictureData = Me!Hidden1.PictureData 
 Case Is = 2 
 Me!Visible1.PictureData = Me!Hidden2.PictureData 
 Case Else 
 End Select 

 If intPic = 2 Then intPic = 0 
 intPic = intPic + 1 
 If (Me!Visible1.Left > gfrmWidth) Then Me!Visible1.Left = 0 
 Me!Visible1.Left = Me!Visible1.Left + 200 

End Sub

另请参阅See also

概念Concepts

切换按钮对象ToggleButton Object

© 2018 Microsoft