《(11.3.1)--9.2Propertiesandmethodsofcontrol.ppt》由会员分享,可在线阅读,更多相关《(11.3.1)--9.2Propertiesandmethodsofcontrol.ppt(15页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、Properties and methods of control object数据库技术与程序设计Properties of control objectProperties of control objectThe Properties of an object describe the static characteristics of the object.buttonbuttontitletitlenamenamebackground background colorcolorheightheightwidthwidthProperties are inherent characte
2、ristics of an object,which can be understood as variables belonging to an object.When creating an object,these variables are assigned.数据库技术与程序设计Properties of control objectThe general format of an Attribute definition statement is:.name=Attribute value=Attribute valueIn In most most cases,cases,the
3、the set name represents represents the the container container to to which which the the current current object object belongs,belongs,such such as form,report,and so on.as form,report,and so on.数据库技术与程序设计Properties of control objectThe general format of the property definition statement is:Me.Comma
4、nd0.Caption=OK Me.Command0.ForeColor=RGB(255,0,0)Me.Command0.Height=600 Me.Command0.Width=1000 数据库技术与程序设计Methods for control objectMethods for control objectMethods for control objectObject methods are also called object member functions,in object-oriented programming,methods can be understood as th
5、e code that enables the object to complete a certain action,which can be directly called in the program.The general format of methods calling code is:.object name.method name.object name.method nameParameter tableParameter table Move the button object Command0 500 units away from the left border of
6、the formMe.Command0.Move(500)数据库技术与程序设计Methods for control objectIllustrate some methods of a few controlsobjectobjectmethodmethodExplanationExplanationForm member methodGoToPageMove focus to the first control on the specified page of the active formMoveMove the form object to the coordinates specif
7、ied by the parameter valueRefreshUpdate forms or datasheets immediatelyTextbox member methodMoveMove the text box to the coordinates specified by the parameter valueRequeryRequery the data source of the text box,and the data on the text box will be updatedLabel member methodMoveMove the label to the
8、 coordinate specified by the parameter valueSizeToFitResize the label control to fit the text or what it contains数据库技术与程序设计Partial member method of DoCmd objectmethodExplanationExplanationCloseIn VBA,close the current object,including forms,reports,queries,and moreCloseDatabaseClose the current data
9、baseCopyObjectCopy an objectDeleteObjectDelete an objectOpenFormOpen formOpenQueryOpen queryOpenReportOpen reportOpenTableOpen the datasheetPrintOutPrint or outputQuitBefore exiting Access 2016,you can choose to save database objects and their dataRunSQLEmbed some SQL statements into the VBA program
10、 to runSaveUpdate and write the data of the current object to the databaseSetFilterFilter active data tables,forms,reports and recorded applications in tablesSetParameterCreate parameters for OpenForm,OpenQuery,OpenReport and other methodsControl object events数据库技术与程序设计Concept of eventEach object ca
11、n recognize and respond to a specific operation action or environmental state change.This specific user operation action or state change is called an event.数据库技术与程序设计Concept of eventIn object-oriented programming,an event is a pre-defined specific action that is activated by the user or the system.S
12、ingle click to trigger Click eventSingle click to trigger Click eventDouble click to trigger DblClick eventDouble click to trigger DblClick eventUsers can code the process of certain events in advance.When an event occurs,the process code of the corresponding event of the object will be executed.数据库
13、技术与程序设计The demonstration数据库技术与程序设计Concept of eventCode the Click event for the button Command0数据库技术与程序设计Concept of eventEdit the Click event codeMe.Command0.Caption=“determine Me.Command0.ForeColor=RGB(255,0,0)Me.Command0.Height=600 Me.Command0.Width=1000 Mmand0.move(500)数据库技术与程序设计Concept of eventbefore and after button click Form 1Form 1Determine数据库技术与程序设计The end of demonstration