|
VFP ·R¥ÎªÌªÀ°Ï ¥»°Q½×°Ï¬° Visual Foxpro ·R¥ÎªÌ¸gÅç¥æ¬yªº¦a¤è, ½Ð¦h¦h§Q¥Î"·j´M"ªº¥\¯à, ¥ý¬d¬Ý¬Ý¦³µL«e¨Ò¥i´`, ¦pªGÁÙ¦³¤£À´ªº¦Aµo°Ý. ³¡¥÷¥DÃD¦³ªþ¥[ÀÉ®×, ¶·¥ýµù¥U¦¨¬°ªÀ°Ï©~¥Á¤~¥i¥H¤U¸ü.
|
¤W¤@½g¥DÃD :: ¤U¤@½g¥DÃD |
µoªí¤H |
¤º®e |
¦¶¨|¿³
µù¥U®É¶¡: 2003-08-25 ¤å³¹: 661 ¨Ó¦Û: ¥x¤¤¥«¤j¨½°Ï
²Ä 166 ¼Ó
|
µoªí©ó: ¬P´Á¤ ¤Q¤G¤ë 17, 2004 10:28 pm ¤å³¹¥DÃD: |
|
|
¦p¦ó¡GÅã¥Üª«¥ó¡B¨Æ¥ó©M¤èªkµ{§Ç©ÒÄ~©Óªºµ{¦¡½X
¦pªGª«¥ó¡B¨Æ¥ó©M¤èªkµ{§Ç¦³µ{¦¡½X®É¡A¥i¥HÀ˵ø¨Ó¦Û¤÷Ãþ§O©ÒÄ~©Óªºµ{¦¡½X¡A¥B«Ü®e©ö¨M©w¬O§_n¨Ï¥Î©ÎÂл\¦¹Ä~©Óªºµ{¦¡½X¡C
ª`·N¡G
[À˵ø¤÷Ãþ§O] ©M [À˵øÄ~©Óªºµ{¦¡½X] ¥\¯à¶È¤ä´©¤÷Ãþ§Oµ{¦¡½XªºÀ˵ø¦ý¤£¯à¥h½s¿è¡CYn½s¿è¦¸Ãþ§Oªº¤÷Ãþ§Oµ{¦¡½X¡A½Ð¨Ï¥Î [Ãþ§OÂsÄý¤u¨ã]¡C¬ÛÃö¸Ô²Ó¸ê°T½Ð°Ñ¦Ò¡u¦p¦ó¡GÀ˵øÃþ§O©w¸qµ{¦¡½X¡v©M¡u¾Þ§@ [Ãþ§OÂsÄý¤u¨ã]¡v¡C
¦p¦ó¨Ï¥Î [µ{¦¡½X] µøµ¡¨ÓÀ˵øÄ~©Óªºµ{¦¡½X
1.°õ¦æ¤U¦C¨ä¤¤¤@Ó¡G
¦bªí³æ¤W¡A«ö¨â¤U©Ònªºª«¥ó¡C
¡Ð©ÎªÌ¡Ð
¦b [ÄÝ©Ê] µøµ¡ªº [ÄÝ©Ê] ²M³æ¤¤¡A¹ï¤@Өƥó©Î¤èªkµ{§Ç«ö¨â¤U¡C
ª«¥ó¡B¨Æ¥ó©M¤èªkµ{§Çªº [µ{¦¡½X] µøµ¡·|¶}±Ò¡C
2.¦b [µ{¦¡½X] µøµ¡¤¤¡A«ö¤@¤U [À˵ø¤÷Ãþ§Oµ{¦¡½X] ¨ÓÅã¥Ü©Ò¦³¤÷Ãþ§Oªº²M³æ¡C
ª`·N¡G
¥u¦³·í¦Ü¤Ö¦³¤@Ó¤÷Ãþ§O§t¦³µ{¦¡½X®É¡A¦b [µ{¦¡½X] µøµ¡¤¤ [À˵ø¤÷Ãþ§Oµ{¦¡½X] ¤~¯à¨Ï¥Î¡C¦pªG¦³ì©lµ{¦¡½X¡A¤÷Ãþ§O¥Î²ÊÅéªí¥Ü¡C
´£¥Ü¡G
¤]¥i¥H¦b [µ{¦¡½X] µøµ¡¤¤³z¹L«ö ALT+I Áä¨ÓÂI¿ï [À˵ø¤÷Ãþ§Oµ{¦¡½X]¡C
3.¿ï¨ú¤÷Ãþ§O¡C
¤@Ó½s¿èµøµ¡·|¶}±Ò¨ÃÅã¥Ü¨ä¤÷Ãþ§Oµ{¦¡½X¡C
¦pªG¤èªkµ{§Ç©Î¨Æ¥ó¦³Ä~©Óªºµ{¦¡½X®É¡A¨Ó¦Û¤èªkµ{§Ç©Î¨Æ¥óªºÄ~©Óµ{¦¡½X¤§¤÷Ãþ§O¦WºÙ©MÃþ§O©w¸q¨ç¼Æ®w·|¦b [ÄÝ©Ê] µøµ¡ªº [ÄÝ©Ê] ²M³æ¤¤¥H¦p¤Uªº¤è¦¡ªí¥Ü¡G
Inherited
cClassname
ClassLibrary
Visual FoxPro ¶ÈÅã¥Ü¿ï©wªº±±¨î¶µªº¨º¨Ç¤÷Ãþ§O¡C¦pªG¤÷Ãþ§O²M³æ¬O¥i¥Îªº¡A¤÷Ãþ§O¨Ì±q³Ìªñ©Î³Ì¤W¼h¤÷Ãþ§O¨ì¤@ӳ̱µªñªº°ò¥»Ãþ§O¨Ó³q¹L¦¹¤÷Ãþ§O¾ðª¬¼h¦¸ªº¶¶§Ç¥X²{¡C¦ý°ò¥»Ãþ§O¬O¤£·|¥X²{ªº¡C
¦pªGµ{¦¡½X¦³Ä~©Ó©ó³Ìªñªº¤÷Ãþ§O¥H¤Î¦¹¤÷Ãþ§O¬O®e¾¹Ãþ§Oªº¤@Ó¦¨û®É¡AVisual FoxPro Åã¥Ü®e¾¹Ãþ§O¡A«á±µ¶¡¹jµM«áÅã¥Ü¦b¤÷Ãþ§O¾ðª¬¼h¦¸¤¤ªºÃþ§O¡C¨ä¥L¦b®e¾¹¶¥¼h¬[ºc¤¤ªºÃþ§O¥i¯à¥]§t¤@¨Çµ{¦¡½X¦ý¤£·|Åã¥Ü¦b²M³æ¤¤¡C
¨Ï¥Î [ÄÝ©Ê] µøµ¡ªº [ÄÝ©Ê] ²M³æ¤¤ªºÀ˵øÄ~©Óªºµ{¦¡½X©P¹C¤÷Ãþ§O©Î®e¾¹Ãþ§O¾ðª¬¼h¦¸¨Ó¨ú±oÄ~©Óªº¤÷Ãþ§O¡C
¬ÛÃö¸ê°T
³B²zª«¥ó
¦p¦ó¡G¦bªí³æ¤¤¥[¤JÄÝ©Ê©M¤èªkµ{§Ç
±±¨îªí³æ¦æ¬°
«Ø¥ßªí³æ
¦p¦ó¡G½s¿è¨Æ¥ó©M¤èªkµ{§Çªºµ{¦¡½X
[ªí³æ³]p¤u¨ã]
----------------------------------------------------------------------------------------------
ì¤å¡G
How to: Display Inherited Code for Objects, Events, and Methods
You can view code inherited from parent classes if it exists for objects, events, and methods, making it easier to decide whether you want to use or override the inherited code.
Note:
The View Parent and View Inherited Code features support only the viewing of parent code, not editing. To edit parent class code for a subclass, use the Class Browser. For more information, see How to: View Class Definition Code and Operating the Class Browser.
To view inherited code using the code window
1.Perform one of the following:
On the form, double-click the object you want.
- OR -
In the properties list of the Properties window, double-click an event or method.
A code window opens for the object, event, or method.
2.In the code window, click View Parent Code to display the list of all parent classes.
Note:
View Parent Code is available in the code window only when there is at least one parent class that contains code. When source code exists, parent classes appear in bold.
Tip:
You can also click View Parent Code in the code window by pressing ALT+I.
3.Select the parent class.
An editing window opens and displays the parent code.
If inherited code exists for a method or event, the parent class name and class libraries from which the method or event inherits code appear in the properties list of the Properties window as follows:
Inherited
cClassname
ClassLibrary
Visual FoxPro displays only those parent classes for the selected control. If a list of parent classes is available, the parent classes appear in order from the most immediate or top parent class to the one closest to the base class, traversing the parent tree. The base class does not appear.
If code inherited from the immediate parent class exists, and the parent class is a member of a container class, Visual FoxPro displays the container class followed by a separator and then the classes in the parent tree. Other classes that traverse the container hierarchy might contain code but are not displayed in the list.
Viewing inherited code using the properties list in the Properties window traverses the parent or container tree to reach the inherited parent class.
See Also
Manipulating Objects
How to: Add Properties and Methods to a Form
Controlling Form Behavior
Creating Forms
How to: Edit Event and Method Code
Form Designer _________________ §Æ±æ¦³§ó¦h¤H¨Ó°Ñ»P
VFP wiki - »Ýn¤j®a¤@°_§¹¦¨ªºVFP¹q¤l®Ñ»PFAQ |
|
¦^³»ºÝ |
|
|
¦¶¨|¿³
µù¥U®É¶¡: 2003-08-25 ¤å³¹: 661 ¨Ó¦Û: ¥x¤¤¥«¤j¨½°Ï
²Ä 167 ¼Ó
|
µoªí©ó: ¬P´Á¤» ¤Q¤G¤ë 18, 2004 11:42 pm ¤å³¹¥DÃD: |
|
|
¦p¦ó¡GÅã¥Ü¤wקï³]©wªºÄÝ©Ê
¦b [ÄÝ©Ê] µøµ¡¤¤¡A¥i¥H¥u¿ï¨ú¨º¨Ç¹w³]Ȥw³Q§ó§ïªºÄÝ©Ê¡C
¦p¦óÀ˵ø¤wקï³]©wªºÄÝ©Ê
1.¦b [ÄÝ©Ê] µøµ¡¥~ªº [ÄÝ©Ê] ²M³æ¤W«ö·Æ¹«¥kÁä¡C
2.±q§ÖÅã¥\¯àªí¤¤¿ï¨ú [¥u¯à¥Î«D¹w³]ÄÝ©Ê]¡C
[ÄÝ©Ê] ²M³æ¥uÅã¥Ü¨º¨Ç³]©wȤw³Q§ó§ïªºÄÝ©Ê¡B¨Æ¥ó©M¤èªkµ{§Ç¡C
¬ÛÃö¸ê°T
³B²zª«¥ó
¦p¦ó¡G¦bªí³æ¤¤¥[¤JÄÝ©Ê©M¤èªkµ{§Ç
±±¨îªí³æ¦æ¬°
«Ø¥ßªí³æ
¦p¦ó¡G½s¿è¨Æ¥ó©M¤èªkµ{§Çªºµ{¦¡½X
[ªí³æ³]p¤u¨ã]
----------------------------------------------------------------------------------------------
ì¤å¡G
How to: Show Properties with Modified Settings
In the Properties window, you can choose to list only those properties for which the default settings have been changed.
To view properties with modified settings
1.Right-click the Properties window outside the properties list.
2.From the shortcut menu, select Non-Default Properties Only.
The properties list shows only those properties, events, and methods whose settings have been changed.
See Also
Manipulating Objects
How to: Add Properties and Methods to a Form
Controlling Form Behavior
Creating Forms
How to: Edit Event and Method Code
Form Designer _________________ §Æ±æ¦³§ó¦h¤H¨Ó°Ñ»P
VFP wiki - »Ýn¤j®a¤@°_§¹¦¨ªºVFP¹q¤l®Ñ»PFAQ |
|
¦^³»ºÝ |
|
|
¦¶¨|¿³
µù¥U®É¶¡: 2003-08-25 ¤å³¹: 661 ¨Ó¦Û: ¥x¤¤¥«¤j¨½°Ï
²Ä 168 ¼Ó
|
µoªí©ó: ¬P´Á¤é ¤Q¤G¤ë 19, 2004 11:02 pm ¤å³¹¥DÃD: |
|
|
³B²zª«¥ó½d¨Ò¡@
¤U±ªº½d¨Ò¦b¤@Óªí³æ¶°¤¤³]©wÄÝ©Ê¡A¨Ã±q¤£¦Pª«¥ó¤¤©I¥s¨Æ¥ó¡C½d¨Òªºªí³æ¶°¤¤¥]§t¨âÓªí³æ¡GfrmLeft ©M frmRight¡C
¥ªªí³æ¤¤ªº¨âÓ®Ö¨ú¤è¶ô©M«ü¥O«ö¶s¤¤¦³»P¥¦Ì¬ÛÃö³sªº¨Æ¥óµ{¦¡½X¡C¥ªªí³æ¤W¤å¦r¿é¤J¤è¶ôªº¦WºÙ¬° txtInput¡C
¥ªªí³æ¤¤ª«¥óªº¨Æ¥óµ{¦¡½X
---------------------------------------------------------
ª«¥ó¡@¡@¡@¨Æ¥ó¡@µ{¦¡½X
--------- ----- -----------------------------------------
chkItalic Click THISFORM.txtInput.FontItalic = THIS.Value
chkBold¡@ Click THIS.txtInput.FontBold = THIS.Value
cmdClear¡@Click THISFORM.txtInput.Value = ""
¡@¡@¡@¡@¡@¡@¡@¡@THISFORM.txtInput.FontBold = .F.
¡@¡@¡@¡@¡@¡@¡@¡@THISFORM.txtInput.FontItalic = .F.
¡@¡@¡@¡@¡@¡@¡@¡@THISFORM.chkItalic.Value = .F.
¡@¡@¡@¡@¡@¡@¡@¡@THISFORM.chkBold.Value = .F.
---------------------------------------------------------
¦b¦P¤@ªí³æ¤¤³]©w¥t¤@±±¨î¶µªºÄÝ©Ê
¨Ï¥Î THISFORM ÃöÁä¦r©Î Parent ÄÝ©Ê¥i¦b¤@Ó±±¨î¶µªº¨Æ¥ó¤¤³]©w¥t¤@Ó±±¨î¶µªºÄÝ©Ê¡C·í¨Ï¥ÎªÌ³Ìªì«ö¤@¤U [±×Åé] ©M [²ÊÅé] ®Ö¨ú¤è¶ô®É¡A´N°õ¦æ¤U±¨âÓ©R¥O¡A³]©w¬Û¹ïªº¤å¦r¿é¤J¤è¶ôÄÝ©Ê¡G
THISFORM.txtInput.FontItalic = .T.
THIS.Parent.txtInput.FontBold = .T.
¦b³oùØ¡ATHISFORM ©M THIS.Parent ¥i¥H¤¬¬ÛÅܧó¡C
cmdClear ªº Click ¨Æ¥ó¤¤ªºµ{¦¡½X¨Ï¥Î¤F THISFORM¡A¨Ó«·s³]©wªí³æ¤W¨ä¥L±±¨î¶µªºÈ¡C
³]©w¥t¤@ªí³æªºÄÝ©Ê
±z¤]¥i¥H¦b¤@Óªí³æ¤¤³]©w¥t¤@Óªí³æªºÄÝ©Ê¡C¥kªí³æ¤¤¥]§t¦³ 5 Ó«ü¥O«ö¶s¡Aªí³æ¤¤ªº²Ä¤@Ó«ö¶sªº Click ¨Æ¥ó¤¤¦³³o¼Ëªºµ{¦¡½X¡G
THISFORMSET.frmLeft.Caption = ALLTRIM(ThisFormSet.frmLeft.txtInput.Value)
ª`·N¦b¤£¦Pªí³æ¶¡³]©wÄݩʮɡA¥²¶·°Ñ¦Òªí³æ¶°©Mªí³æ¡C
¥kªí³æ¤Wªº²Ä¤GÓ«ü¥O«ö¶sªº Click ¨Æ¥óªºµ{¦¡½X®i¥Ü¤F¦p¦ó¦bªí³æªºª«¥ó¤¤³]©w¥t¤@ªí³æªºÄÝ©Ê¡G
THISFORM.Caption = ALLTRIM(ThisFormSet.frmLeft.txtInput.Value)
¦pªG¨Ï¥ÎªÌ¿ï©w¤F³oÓ«ö¶s¡A¥kªí³æªº¼ÐÃD±NÅܬ°¥ªªí³æ¤¤¤å¦r¿é¤J¤è¶ô¤¤ªºÈ¡C
¦s¨ú¤£¦Pªí³æ¤¤ªºª«¥ó
¤U±ªºµ{¦¡½XÄÝ©ó [Åܧó²ÊÅ骺³]©wÈ] «ü¥O«ö¶sªº Click ¨Æ¥ó¡A¥¦§ïÅÜ¥ªªí³æ¤¤ªº [²ÊÅé] ®Ö¨ú¤è¶ô¡A©I¥s»P³oÓ±±¨î¶µ¬ÛÃö³sªº¨Æ¥óµ{¦¡½X¡C
THISFORMSET.frmLeft.chkBold.Value = !THISFORMSET.frmLeft.chkBold.Value
THISFORMSET.frmLeft.chkBold.InteractiveChange
½d¨Ò¤¤ªº³Ì«á¤@¦æ©I¥s¤F chkBold ªº InteractiveChange ¨Æ¥ó¡C¤]¥i¥Î¤U±ªº©R¥O©I¥s¦¹µ{§Ç¡G
THISFORMSET.frmForm1.chkBold.InteractiveChange( )
¦pªG©¿²¤³oÓµ{§Ç©I¥s¡AÁöµM®Ö¨ú¤è¶ôªºÈ·|§ïÅÜ¡A¦ý¤å¦r¿é¤J¤è¶ôªº FontBold Äݩʥû·¤£·|¬Û¹ïÀ³¦a§ïÅÜ¡C
ÅçÃÒÄÝ©Ê©M©I¥s¥t¤@ªí³æªº¤èªkµ{§Çµ{¦¡½X
¤U±ªºµ{¦¡½XÄÝ©ó [ÁôÂÃ¥ªªí³æ] «ü¥O«ö¶sªº Click ¨Æ¥ó¡A¥¦¥Î©óÁôÂéÎÅã¥Üªí³æ¡A¨Ã®Ú¾Ú Visible ÄݩʪºÈ¬Û¹ïÀ³¦a§ïÅÜ«ö¶sªº¼ÐÃD¡G
IF ThisFormSet.frmLeft.Visible
¡@ ThisFormSet.frmLeft.Hide
¡@ THIS.Caption = "Åã¥Ü¥ªªí³æ"
ELSE
¡@ ThisFormSet.frmLeft.Show
¡@ THIS.Caption = "ÁôÂÃ¥ªªí³æ"
ENDIF
ª`·N¡A±±¨î¶µªº¨Æ¥óµ{¦¡½X¤¤¨Ï¥Î¤F THIS ÃöÁä¦r¨Ó°Ñ¦Ò³oÓ±±¨î¶µªºÄÝ©Ê¡C
¤U±ªºµ{¦¡½XÄÝ©ó [Ãö³¬] «ü¥O«ö¶sªº Click ¨Æ¥ó¡A¥Î©óÄÀ©ñªí³æ¶°¡AÃö³¬©Ò¦³ªºªí³æ¡G
RELEASE ThisFormSet
¬ÛÃö¸ê°T
³B²zªí³æ
³B²zª«¥ó
¦p¦ó¡G¦b°õ¦æ®É´Á³]©wÄÝ©Ê
¦p¦ó¡GÁôÂêí³æ
«Ø¥ßªí³æ
¦p¦ó¡G¶Ç»¼°Ñ¼Æµ¹ªí³æ
¦p¦ó¡G±Nªí³æ¦s¦¨ HTML Àɮס@
----------------------------------------------------------------------------------------------
ì¤å¡G
Example of Manipulating Objects¡@
The following example sets properties and calls event code from various objects within a form set. The example includes two forms, frmLeft and frmRight, in a formset.
The two check boxes and the command button on frmLeft have event code associated with them. The name of the text box on frmLeft is txtInput.
Event Code for Objects in LeftForm
----------------------------------------------------------
Object¡@¡@Event Code
--------- ----- -----------------------------------------
chkItalic Click THISFORM.txtInput.FontItalic = THIS.Value
chkBold¡@ Click THIS.txtInput.FontBold = THIS.Value
cmdClear¡@Click THISFORM.txtInput.Value = ""
¡@¡@¡@¡@¡@¡@¡@¡@THISFORM.txtInput.FontBold = .F.
¡@¡@¡@¡@¡@¡@¡@¡@THISFORM.txtInput.FontItalic = .F.
¡@¡@¡@¡@¡@¡@¡@¡@THISFORM.chkItalic.Value = .F.
¡@¡@¡@¡@¡@¡@¡@¡@THISFORM.chkBold.Value = .F.
----------------------------------------------------------
Setting a Property of Another Control on the Same Form
You can set the properties of one control from within the event code of another by using the THISFORM keyword or the Parent property. The following two commands are executed when a user initially clicks on the Italic and the Bold check boxes, setting the appropriate text box properties:
THISFORM.txtInput.FontItalic = .T.
THIS.Parent.txtInput.FontBold = .T.
In this case, THISFORM and THIS.Parent can be used interchangeably.
The code in the click event for cmdClear uses THISFORM to reset the values of the other controls on the form.
Setting Another Form's Properties
You can also set properties of one form from another. Form2 contains five command buttons. The first button on the form has this code in its Click event:
THISFORMSET.frmLeft.Caption = ALLTRIM(ThisFormSet.frmLeft.txtInput.Value)
Notice that the form set and the form need to be referenced when setting properties from within a different form.
The click event code of the second command button on frmRight demonstrates setting a property of a form from within an object on the form:
THISFORM.Caption = ALLTRIM(ThisFormSet.frmLeft.txtInput.Value)
If the user chooses this button, the caption of frmRight changes to the value in the text box on frmLeft.
Accessing Objects on Different Forms
The following code in the Click event of the Change Bold Setting command button changes the value of the Bold check box on frmLeft and calls the event code associated with this control.
THISFORMSET.frmLeft.chkBold.Value = !THISFORMSET.frmLeft.chkBold.Value
THISFORMSET.frmLeft.chkBold.InteractiveChange
The last line of the example calls the InteractiveChange event of chkBold. You could also call this procedure with the following command:
THISFORMSET.frmForm1.chkBold.InteractiveChange( )
If this procedure call is omitted, the value of the check box changes, but the FontBold property of the text box is never changed.
Checking Properties and Calling Method Code of Another Form
The following code in the Click event of the Hide Left Form command button hides or shows frmLeft, depending on the value of the Visible property, and changes the button caption as appropriate:
IF ThisFormSet.frmLeft.Visible
¡@ ThisFormSet.frmLeft.Hide
¡@ THIS.Caption = "Show Left Form"
ELSE
¡@ ThisFormSet.frmLeft.Show
¡@ THIS.Caption = "Hide Left Form"
ENDIF
Notice that the THIS keyword is used within event code of a control to reference properties of the control.
The following command in the Click event of the Quit command button releases the form set, causing both forms to close:
RELEASE ThisFormSet
See Also
Working with Forms
Manipulating Objects
How to: Set Properties at Run Time
How to: Hide a Form
Creating Forms
How to: Pass Parameters to a Form
How to: Save a Form as HTML _________________ §Æ±æ¦³§ó¦h¤H¨Ó°Ñ»P
VFP wiki - »Ýn¤j®a¤@°_§¹¦¨ªºVFP¹q¤l®Ñ»PFAQ |
|
¦^³»ºÝ |
|
|
¦¶¨|¿³
µù¥U®É¶¡: 2003-08-25 ¤å³¹: 661 ¨Ó¦Û: ¥x¤¤¥«¤j¨½°Ï
²Ä 169 ¼Ó
|
µoªí©ó: ¬P´Á¤@ ¤Q¤G¤ë 20, 2004 11:10 pm ¤å³¹¥DÃD: |
|
|
¦Ûqªí³æ
±z¥i¥H§ïµ½ªí³æ¡A¨Ï¥¦Ì¬Ý°_¨Ó§ó¦³²Õ´¨Ã¥B§ó©ö©ó¨Ï¥Î¡C¨Ò¦p¡A¥i¥Hµe¤@Ó¤è¶ô§â¤@²Õ¬Û¦üªº±±¨î¶µ®Ø¦b¤@°_¡A©ÎªÌ¥ÎÂI°}¹Ï¨Ïªí³æ¬Ý°_¨Ó§ó±M·~¤Æ¡C
¨Ï¥Î [ªí³æ³]p¤u¨ã]¡A±z¥i¥H³o¼Ë¦Ûqªí³æ¡G
¡E§ïÅܤå¦rªº¦r«¬©M¤j¤p¡C
¡E¦bªí³æ¤¤¥[¤J´X¦ó¹Ï§Î©M½u±ø¡C
¡E¦bªí³æ¤¤¥[¤J¹Ï§Î¡C
¡E³]©w¤@Óªí³æªº«e´º©MI´ºÃC¦â¡C
¦b¥»³¹¸`¤¤
¦p¦ó¡G§ïÅܤå¦rªºÄÝ©Ê
´yz¸Ó¦p¦ó¦bªí³æ¤¤Åܧó¤å¦r¡C
¦p¦ó¡G¦bªí³æ¤¤¥[¤J´X¦ó¹Ï§Î©M½u±ø
´yz¸Ó¦p¦ó¦bªí³æ¤W©ñ¸m½u±øª«¥ó©M´X¦ó¹Ï§Îª«¥ó¡C
¦p¦ó¡G¦bªí³æ¤¤¥[¤J¹Ï§Î
»¡©ú¦p¦ó¨Ï¥Î¼v¹³±±¨î¶µ¦bªí³æ¤¤¥[¤J¹Ï§Î¡C
¦p¦ó¡G³]©wªí³æªºÃC¦â
´yz¸Ó¦p¦ó³z¹L¨Ï¥Î ColorSource Äݩʨӱ±¨îªí³æªºÃC¦â¡C
¦p¦ó¡G«ü©wªí³æªº¹Ï¥Ü
´yz¸Ó¦p¦ó«ü©wªí³æªº¹Ï¥Ü¡C
¬ÛÃö³¹¸`
³B²zªí³æ
´£¨Ñ¡u»¡©ú¦p¦ó³B²zªí³æ¡A¨Ò¦p¦p¦ó°õ¦æªí³æ©Î¦p¦ó°±¾nªí³æ¡vªº¥DÃD³sµ²¡C
«Ø¥ßªí³æ
´yz¸Ó¦p¦ó³]p©M«Ø¥ßªí³æ¡B¦p¦ó¨Ï¥Îªí³æ¶°©Mªí³æÃþ«¬¡B¦p¦ó¦bªí³æ¤W¨Ï¥Îª«¥ó¡B¦p¦ó¨Ï¥ÎÄÝ©Ê»P¤èªkµ{§Ç¨Ó¦Ûqªí³æ¥H¤Î¦p¦ó³]©w¸ê®ÆÀô¹Ò¡C ¡@
----------------------------------------------------------------------------------------------
ì¤å¡G
Customizing Forms
You can add enhancements to your forms to make them more interesting visually and easier to use. For example, you might want to group similar controls together visually by drawing a box around them, or use images to give the forms a more professional appearance.
Using the Form Designer, you can customize your forms by:
¡EChanging text fonts and sizes.
¡EAdding shapes and lines to a form.
¡EAdding graphics to a form.
¡ESetting the foreground and background colors of a form.
In This Section
How to: Change Text Properties
Describes how to change the text in a forms.
How to: Add Shapes and Lines to Forms
Describes how to place lines and shapes objects on a form.
How to: Add Graphics to Forms
Explains how to use the Image control to add graphics to a form.
How to: Set Form Colors
Describes how to control a forms color by using the forms ColorSource property.
How to: Assign an Icon to a Form
Describes how to assign an icon to a form.
Related Sections
Working with Forms
Provides links to topics that explain how to work with forms, such as how to run a form or how to doc forms.
Creating Forms
Describes how to design and build forms, how to use form sets and form types, how to use objects on forms, how to customize forms using properties and methods, and how to set the data environment. _________________ §Æ±æ¦³§ó¦h¤H¨Ó°Ñ»P
VFP wiki - »Ýn¤j®a¤@°_§¹¦¨ªºVFP¹q¤l®Ñ»PFAQ |
|
¦^³»ºÝ |
|
|
¦¶¨|¿³
µù¥U®É¶¡: 2003-08-25 ¤å³¹: 661 ¨Ó¦Û: ¥x¤¤¥«¤j¨½°Ï
²Ä 170 ¼Ó
|
µoªí©ó: ¬P´Á¤G ¤Q¤G¤ë 21, 2004 11:43 pm ¤å³¹¥DÃD: |
|
|
¦p¦ó¡G§ïÅܤå¦rªºÄÝ©Ê
¨Ï¥Î [ÄÝ©Ê] µøµ¡¤¤ªº¦r«¬ÄÝ©Ê¡A¥i¥HÅܧó¦bªí³æ¤¤©Ò¥[¤Jªº±±¨î¶µ¤W¥X²{ªº¤å¦rªº¼Ë¦¡©M¤j¤p¡C±z¥i¥H±q¨t²Î©Ò¤ä´©ªº¥i¥Î¦r«¬¼Ë¦¡©M¤j¤p¶i¦æ¿ï¨ú¡CYn§ïÅܪí³æ¤¤ªº¤å¦r¡A¥i§ïÅܦr«¬ÄÝ©Ê¡A¨Ò¦p FontName¡BFontSize ©M FontBold¡A³o¨ÇÄݩʧ¡¦C¦b [ÄÝ©Ê] µøµ¡¤¤¡C
¦p¦ó§ïÅܪí³æ¤¤ªº¤å¦r
1.¦b [ªí³æ³]p¤u¨ã] ¤¤¿ï¨únÅܧ󪺱±¨î¶µ¡C
2.¦b [ÄÝ©Ê] µøµ¡¤¤ªº¤U©Ô [ª«¥ó] ²M³æ¤¤¡A¿ï¨ú·QÅܧ󪺪«¥ó¡C
3.§ä¨ìnÅܧ󪺦r«¬ÄÝ©Ê¡A¨Ã³]©w¥¦ªºÈ¡C
¬ÛÃö¸ê°T
¦Ûqªí³æ
[ªí³æ³]p¤u¨ã]
[ÄÝ©Ê] µøµ¡ (Visual FoxPro)
DynamicFontBold¡BDynamicFontItalic¡BDynamicFontStrikethru¡BDynamicFontUnderline ÄÝ©Ê
ColorSource ÄÝ©Ê
¦p¦ó¡G³]©wªí³æªº³]p°Ï°ì ¡@
----------------------------------------------------------------------------------------------
ì¤å¡G
How to: Change Text Properties
Using the font properties in the Properties window, you can modify the style and size of the text that appears in controls you have added to your forms. You can choose from the available font styles and sizes supported by your system. To change the text in your form, change the font properties, such as FontName, FontSize, and FontBold, shown in the Properties window.
To change the text in your forms
1.In the Form Designer, select the control you want to change.
2.In the Properties window, drop down the Object list, and select the object you want to change.
3.Locate the font property you want to change, and set its value.
See Also
Customizing Forms
Form Designer
Properties Window (Visual FoxPro)
DynamicFontBold, DynamicFontItalic, DynamicFontStrikethru, DynamicFontUnderline Properties
ColorSource Property
How to: Set the Design Area for a Form _________________ §Æ±æ¦³§ó¦h¤H¨Ó°Ñ»P
VFP wiki - »Ýn¤j®a¤@°_§¹¦¨ªºVFP¹q¤l®Ñ»PFAQ |
|
¦^³»ºÝ |
|
|
¦¶¨|¿³
µù¥U®É¶¡: 2003-08-25 ¤å³¹: 661 ¨Ó¦Û: ¥x¤¤¥«¤j¨½°Ï
²Ä 171 ¼Ó
|
µoªí©ó: ¬P´Á¤T ¤Q¤G¤ë 22, 2004 11:43 pm ¤å³¹¥DÃD: |
|
|
¦p¦ó¡G¦bªí³æ¤¤¥[¤J´X¦ó¹Ï§Î©M½u±ø
¥i¥H¦bªí³æ¤¤¥[¤J´X¦ó¹Ï§Î©M½u±ø¨Ó¦Ûqªí³æ¡C¨Ò¦p¡A§â´X²Õ±±¨î¶µ¥Î¤À¹j½u¤À¶}¡A©Î¬°¹jÂ÷¥¦Ì¦Ó§â¬ÛÃö±±¨î¶µ¥]³ò°_¨Ó¡C
¦p¦ó¦bªí³æ¤¤¥[¤J½u±ø
1.¦b [ªí³æ±±¨î¶µ] ¤u¨ã¦C¤¤¿ï¨ú [½u±ø] «ö¶s¡C
2.¦bªí³æ¤¤©ì¦²·Æ¹«²£¥Í½u±ø¡C
±z¥i¥H¹³³B²z¨ä¥¦±±¨î¶µ¤@¼Ë²¾°Ê½u±ø©Î½Õ¾ã¥¦ªº¤j¤p¡A©ÎªÌ¥Î [ÄÝ©Ê] µøµ¡¤¤ªº LineSlant ÄݩʧïÅܽu±øªº¶É±×«×¡C
¦p¦ó¦bªí³æ¤¤¥[¤J´X¦ó¹Ï§Î
1.¦b [ªí³æ±±¨î¶µ] ¤u¨ã¦C¤¤¿ï¨ú [´X¦ó¹Ï§Î] «ö¶s¡C
2.¦bªí³æ¤¤©ì¦²·Æ¹«²£¥Í´X¦ó¹Ï§Î¡C
±z¥i¥H§ïÅܥΠ[ÄÝ©Ê] µøµ¡¤¤ªº Curvature ÄÝ©Ê©Òµe´X¦ó¹Ï§Îªº«¬ºA¡C
¬ÛÃö¸ê°T
¦Ûqªí³æ
³B²zªí³æ
«Ø¥ßªí³æ
[ªí³æ³]p¤u¨ã]
[ÄÝ©Ê] µøµ¡ (Visual FoxPro)
ColorSource ÄÝ©Ê
¦p¦ó¡G³]©wªí³æªº³]p°Ï°ì
----------------------------------------------------------------------------------------------
ì¤å¡G
How to: Add Shapes and Lines to Forms
You can add shapes and lines to forms to customize them. For example, you may want to separate groups of controls with a dividing line, or enclose related controls within a box to set them apart.
To add a line to a form
1.In the Form Controls toolbar, choose the Line button.
2.Drag in the form to create a line.
You can size and move the line like other controls, or change the slant of the line with the LineSlant Property in the Properties window.
To add a shape to a form
1.In the Form Controls toolbar, choose the Shape button.
2.Drag in the form to create a shape.
You can change the type of shape drawn with the Curvature property in the Properties window.
See Also
Customizing Forms
Working with Forms
Creating Forms
Form Designer
Properties Window (Visual FoxPro)
ColorSource Property
How to: Set the Design Area for a Form _________________ §Æ±æ¦³§ó¦h¤H¨Ó°Ñ»P
VFP wiki - »Ýn¤j®a¤@°_§¹¦¨ªºVFP¹q¤l®Ñ»PFAQ |
|
¦^³»ºÝ |
|
|
¦¶¨|¿³
µù¥U®É¶¡: 2003-08-25 ¤å³¹: 661 ¨Ó¦Û: ¥x¤¤¥«¤j¨½°Ï
²Ä 172 ¼Ó
|
µoªí©ó: ¬P´Á¥| ¤Q¤G¤ë 23, 2004 10:21 pm ¤å³¹¥DÃD: |
|
|
¦p¦ó¡G¦bªí³æ¤¤¥[¤J¹Ï§Î
±z¥i¥H§â¹Ï¤ù¥[¤J¨ìªí³æªºI´º¤¤¡A©Î§â¹Ï¤ù¥[¤J¨ìªí³æ¤ºªº¤è¶ô¤¤¡C
¦p¦ó¦bªí³æ¤¤¥[¤J¹Ï§Î
1.¿ï¾Ü¤U¦C¦U¶µ¤§¤@¡G
¡En§ïÅܪí³æªºI´º¡A¿ï¨ú¸Óªí³æ¡C ¡Ð©ÎªÌ¡Ð
¡En¦bªí³æ¤¤¥[¤J¹Ï¤ù¡A±q [ªí³æ±±¨î¶µ] ¤u¨ã¦C¤¤¿ï¨ú [¹Ï¤ù] ±±¨î¶µ¨Ã§â¥¦©ñ¦bªí³æ¤W¡C
2.¦b [ÄÝ©Ê] µøµ¡¡A¿ï¨ú Picture ÄÝ©Ê¡C
3.¿ï¨ú¹ï¸Ü¤è¶ô«ö¶s¡AÅã¥Ü [¶}±ÒÂÂÀÉ] ¹ï¸Ü¤è¶ô¡C
4.§ä¨ì©Ò»Ýªº¹Ï¤ùÀɮשΨä¥LÀɮסC
5.¿ï¨ú [½T©w] «ö¶s¡C
¬ÛÃö¸ê°T
¹Ï¤ù±±¨î¶µ (Visual FoxPro)
Picture ÄÝ©Ê (Visual FoxPro)
BackStyle ÄÝ©Ê
BackColor¡BForeColor ÄÝ©Ê
¦Ûqªí³æ
[ªí³æ³]p¤u¨ã]
[ÄÝ©Ê] µøµ¡ (Visual FoxPro)
ColorSource ÄÝ©Ê
¦p¦ó¡G³]©wªí³æªº³]p°Ï°ì
----------------------------------------------------------------------------------------------
ì¤å¡G
How to: Add Graphics to Forms
You can add an image to the background of your form, or add an image to a box inside the form.
To add a graphic to your form
1.Choose one of the following:
¡ETo change the background of the form, select the form. - OR -
¡ETo add a picture to your form, select an Image control from the Form Controls toolbar and place it on the form.
2.In the Properties window, select the Picture property.
3.Choose the dialog button to display the Open dialog box.
4.Locate the image or other file you want to use.
5.Choose OK.
See Also
Image Control (Visual FoxPro)
Picture Property (Visual FoxPro)
BackStyle Property
BackColor, ForeColor Properties
Customizing Forms
Form Designer
Properties Window (Visual FoxPro)
ColorSource Property
How to: Set the Design Area for a Form _________________ §Æ±æ¦³§ó¦h¤H¨Ó°Ñ»P
VFP wiki - »Ýn¤j®a¤@°_§¹¦¨ªºVFP¹q¤l®Ñ»PFAQ |
|
¦^³»ºÝ |
|
|
¦¶¨|¿³
µù¥U®É¶¡: 2003-08-25 ¤å³¹: 661 ¨Ó¦Û: ¥x¤¤¥«¤j¨½°Ï
²Ä 173 ¼Ó
|
µoªí©ó: ¬P´Á¤ ¤Q¤G¤ë 24, 2004 11:44 pm ¤å³¹¥DÃD: |
|
|
¦p¦ó¡G³]©wªí³æªºÃC¦â
±z¥i¥H±±¨îªí³æªºÃC¦â¡A¤èªk¬O®Ú¾Ú¦s¦bªº°t¦â¤è®×¡A¨Ï¥Î ColorSource ÄÝ©Ê¡A©ÎªÌ¨Ï¥Î [½Õ¦âªO] ¤u¨ã¦C§ïÅܪí³æ©M¨ä¤¤±±¨î¶µªº«e´º©ÎI´ºÃC¦â¡C
¦p¦ó¥Î ColorSource Äݩʳ]©wªí³æÃC¦â
¡E¦b [ÄÝ©Ê] µøµ¡ªº [°t¸m] ¼ÐÅÒ¤¤¡A¿ï¨ú ColorSource ÄÝ©Ê¡AµM«á¿ï¨ú¤@ÓÈ¡C
¦p¦ó³]©wªí³æ©Î±±¨î¶µªº«e´º©ÎI´ºÃC¦â
1.±q [À˵ø] ¥\¯àªí¤¤¡A¿ï¨ú [¤u¨ã¦C] ¨Ã¿ï¨ú [½Õ¦âªO]¡C
2.¿ï¨ú [«e´º¦â] «ö¶s©Î [I´º¦â] «ö¶s¡C
3.¿ï¨ú·Q§ïÅܪº±±¨î¶µ©Îªí³æ¡C
4.¦b [½Õ¦âªO] ¤u¨ã¦C¤¤¿ï¨ú·Q¨Ï¥ÎªºÃC¦â¡C
5.¦pªG§Æ±æ¦³§ó¦hªºÃC¦â¥i¨Ñ¿ï¨ú¡A¥i¿ï¨ú [¨ä¥LÃC¦â] «ö¶s¡C
¦p¦ó«Ø¥ß¦Ûq¦â±m
1.¦b [½Õ¦âªO] ¤u¨ã¦C¤¤¡A¿ï¨ú [¨ä¥LÃC¦â]¡C
2.¦b [¦â±m] ¹ï¸Ü¤è¶ô¤¤¡A¿ï¨ú [©w¸q¦Ûq¦â±m] Åã¥Ü [¦ÛqÃC¦â¿ï¨ú¾¹]¡C
3.¿ï¨ú¤@Ó [¦Ûq¦â±m] ¤è¶ô¡AµM«á¦b [¦ÛqÃC¦â¿ï¨ú¾¹] ¤¤«ö¤@¤U¡A¿ï¨ú©Ò»Ýªº¦Ûq¦â±m¡C
4.¿ï¨ú [¥[¨ì¦Ûq¦â±m]¡A§â·sÃC¦â¥[¤J¨ì½Õ¦âªO¤¤¡C
5.¿ï¨ú [½T©w] «ö¶s¡C
Visual FoxPro ¥Ø«eªº¿ï¶µ§Y¥iÀ³¥Î¦Ûq¦â±m¡C
¬ÛÃö¸ê°T
BackStyle ÄÝ©Ê
BackColor¡BForeColor ÄÝ©Ê
¦Ûqªí³æ
³B²zªí³æ
«Ø¥ßªí³æ
[ªí³æ³]p¤u¨ã]
[ÄÝ©Ê] µøµ¡ (Visual FoxPro)
¦p¦ó¡G³]©wªí³æªº³]p°Ï°ì
----------------------------------------------------------------------------------------------
ì¤å¡G
How to: Set Form Colors
You can control a form's colors by using the ColorSource Property to base the colors on an existing color scheme, or you can use the Color Palette toolbar to change the foreground or background color of your forms and the controls within them.
To set form colors using the ColorSource property
¡EOn the Layout tab in the Properties window, choose ColorSource and select a value.
To set the foreground or background color of a form or control
1.From the View menu, select Color Palettetoolbar.
2.Choose Foreground Color or Background Color.
3.Select the control or form you want to change.
4.In the Color Palette toolbar, select the color you want to use.
5.To see more color choices, choose Other Colors on the toolbar.
To create a custom color
1.In the Color Palette toolbar, choose Other Colors.
2.In the Color dialog box, choose Define Custom Colors to display the Custom Color Selector.
3.Select one of the Custom Colors boxes, and then click in the Custom Color Selector to select the custom color you want.
4.Choose Add to Custom Colors to add the new color to your palette.
5.Choose OK.
Visual FoxPro applies the custom color to the current selection.
See Also
BackStyle Property
BackColor, ForeColor Properties
Customizing Forms
Working with Forms
Creating Forms
Form Designer
Properties Window (Visual FoxPro)
How to: Set the Design Area for a Form _________________ §Æ±æ¦³§ó¦h¤H¨Ó°Ñ»P
VFP wiki - »Ýn¤j®a¤@°_§¹¦¨ªºVFP¹q¤l®Ñ»PFAQ |
|
¦^³»ºÝ |
|
|
¦¶¨|¿³
µù¥U®É¶¡: 2003-08-25 ¤å³¹: 661 ¨Ó¦Û: ¥x¤¤¥«¤j¨½°Ï
²Ä 174 ¼Ó
|
µoªí©ó: ¬P´Á¤é ¤Q¤G¤ë 26, 2004 11:32 am ¤å³¹¥DÃD: |
|
|
¦p¦ó¡G«ü©wªí³æªº¹Ï¥Ü
¦b Visual FoxPro ¤¤¡A¥i«ü©wªí³æªº¹Ï¥Ü¡F¹Ï¥Ü·|Åã¥Ü¦bªí³æªº¥ô°È¦C«ö¶s¤W¥H¤Îªí³æªº¼ÐÃD¦C¤¤¡C ¦pªGn«ü©wªí³æªº¹Ï¥Ü¡A±Nªí³æªº Icon Äݩʳ]©w¬°¤@Ó .ico ÀɮתºÀɮצWºÙ¡C
Yn«ü©wªí³æªº¹Ï¥Ü
1.¶}±Òªí³æ¡C
2.¶}±Ò [ÄÝ©Ê] µøµ¡¡C
3.±N Icon Äݩʳ]©w¬°§Æ±æÅã¥Üªº .ico ÀɮסC
¬ÛÃö¸ê°T
¦p¦ó¡G¦bªí³æ¤¤¥[¤JÄÝ©Ê©M¤èªkµ{§Ç
³B²zª«¥ó
¦p¦ó¡G½s¿è¨Æ¥ó©M¤èªkµ{§Çªºµ{¦¡½X
«Ø¥ßªí³æ
[ªí³æ³]p¤u¨ã]
Visible ÄÝ©Ê (Visual FoxPro)
¦p¦ó¡GÀx¦sªí³æ
----------------------------------------------------------------------------------------------
ì¤å¡G
How to: Assign an Icon to a Form
In Visual FoxPro, you can assign an icon to the form; the icon is displayed on a forms taskbar button and in the title bar of the form. To assign an icon to a form, set the form's Icon property to the name of an .ico file.
To assign an icon to a form
1.Open the form.
2.Open the Properties window.
3.Set the Icon property to the .ico file that you want to display.
See Also
How to: Add Properties and Methods to a Form
Manipulating Objects
How to: Edit Event and Method Code
Creating Forms
Form Designer
Visible Property (Visual FoxPro)
How to: Save Forms _________________ §Æ±æ¦³§ó¦h¤H¨Ó°Ñ»P
VFP wiki - »Ýn¤j®a¤@°_§¹¦¨ªºVFP¹q¤l®Ñ»PFAQ |
|
¦^³»ºÝ |
|
|
¦¶¨|¿³
µù¥U®É¶¡: 2003-08-25 ¤å³¹: 661 ¨Ó¦Û: ¥x¤¤¥«¤j¨½°Ï
²Ä 175 ¼Ó
|
µoªí©ó: ¬P´Á¤é ¤Q¤G¤ë 26, 2004 9:47 pm ¤å³¹¥DÃD: |
|
|
¦p¦ó¡G¦bªí³æ¤¤¥[¤JÄÝ©Ê©M¤èªkµ{§Ç
¥i¥H¦bªí³æ¶°©Î¨S¦³ªí³æ¶°ªºªí³æ¤¤¡A·s¼W¥ô·N¦hÓÄÝ©Ê©M¤èªkµ{§Ç¡CÄݩʾ֦³¤@ÓÈ¡A¦Ó¤èªkµ{§Ç¾Ö¦³µ{¦¡½X¡A·í©I¥s¤èªkµ{§Ç®É¡A§Y°õ¦æ³o¤@µ{¦¡½X¡C·sªºÄÝ©Ê©M¤èªkµ{§ÇÄÝ©óªí³æ¡A±z¥i¥H¹³°Ñ¦Ò¨ä¥LÄݩʩΤèªkµ{§Ç¨º¼Ë°Ñ¦Ò¥¦Ì¡C
«Ø¥ß·sÄÝ©Ê
¦pªG¤w«Ø¥ß¤@Óªí³æ¶°¡A¨º»ò¦b [ªí³æ³]p¤u¨ã] ¤¤¥[¤JªºÄÝ©Ê©M¤èªkµ{§Ç´NÄÝ©ó¸Óªí³æ¶°¡C¦pªG¨S¦³«Ø¥ßªí³æ¶°¡A«hÄÝ©Ê©M¤èªkµ{§ÇÄÝ©óªí³æ¡C
Yn¦bªí³æ¤¤·s¼WÄÝ©Ê
1.±q [ªí³æ] ¥\¯àªí¤¤¿ï©w [·sÄÝ©Ê] ©R¥O¡C
2.¦b [·sÄÝ©Ê] ¹ï¸Ü¤è¶ô¤¤¡AÁä¤JÄݩʪº¦WºÙ¡CÁÙ¥i¥H¥[¤JÃö©ó³oÓÄݩʪº´yz¡A¥¦¥i¥HÅã¥Ü¦b [ÄÝ©Ê] µøµ¡ªº©³³¡¡C
«Ø¥ß°}¦CÄÝ©Ê
°}¦CÄÝ©Ê©M¨ä¥LÄݩʤ@¼Ë³£ÄÝ©óªí³æ©Îªí³æ¶°¡A¤£¦Pªº¬O¥i¥Î Visual FoxPro ªº°}¦C©R¥O©M¨ç¼Æ³B²z¥¦¡C
Yn«Ø¥ß¤@Ó°}¦CÄÝ©Ê
1.¦bªí³æ¤¤²K¥[·sÄÝ©Ê¡C
2.¦b [·sÄÝ©Ê] ¹ï¸Ü¤è¶ôªº [¦WºÙ] ¤è¶ô¤¤Áä¤J°}¦CÄݩʪº¦WºÙ¡A¥]¬A°}¦Cªº¤j¤p©Mºû¼Æ¡C
¨Ò¦p¡An«Ø¥ß¤@Ó 10 ¦Cªº¤Gºû°}¦C¡AÀ³¦b [·sÄÝ©Ê] ¹ï¸Ü¤è¶ôªº [¦WºÙ] ¤è¶ô¤¤Áä¤J arrayprop[10,2]¡C
¦bªí³æ¤¤·s¼W§¹°}¦CÄÝ©Ê«á¡AÄݩʦbÄݩʲM³æµøµ¡¤¤¥H°ßŪ¼Ò¦¡Åã¥Ü¡C±z¥i¥H¦b°õ¦æ®É´ÁºÞ²z°}¦C¡A«·s³]©w°}¦Cªººû¼Æ¡A¤]¥i«ü¬£¤@Óȵ¹°}¦CÄݩʪº¤¸¯À¡C¦³Ãö¨Ï¥Î°}¦CÄݩʪº½d¨Ò¡A½Ð°Ñ¾\¡u¦p¦ó¡GºÞ²zªí³æªº¦hӮרҡv¡C
«Ø¥ß·sªº¤èªkµ{§Ç
±z¥i¦bªí³æ¤¤·s¼W¤èªkµ{§Ç¡A¦Ó©I¥s·s¼Wªº¤èªkµ{§Çªº¤èªk©M©I¥s¤@¯ëªí³æªº¤èªkµ{§Ç¤@¼Ë¡C
Yn¦bªí³æ¤¤«Ø¥ß¤@Ó·s¤èªkµ{§Ç
1.±q [ªí³æ] ¥\¯àªí¤¤¿ï©w [·s¤èªkµ{§Ç]¡C
2.¦b [«Ø¥ß·sªº¤èªkµ{§Ç] ¹ï¸Ü¤è¶ô¤¤¡AÁä¤J¤èªkµ{§Çªº¦WºÙ¡CÁÙ¥i¥H¥]§t¦³Ãö³oÓ¤èªkµ{§Çªº´yz¡A³o¬O¥i¿ïªº¡C
©I¥s¨Ï¥ÎªÌ¦Ûqªº¤èªkµ{§Ç©M©I¥s°ò¥»Ãþ§Oªº¤èªkµ{§Ç¤@¼Ë¡A³£¨Ï¥Î¤U±ªº»yªk¡G
ObjectName.MethodName
±z«Ø¥ßªº¤èªkµ{§Ç¦P¼Ë¥i¥H±µ¨ü°Ñ¼Æ¨Ã¶Ç¦^È¡A³oºØ±¡ªp¤U¡A±z¥i¥H¨Ï¥Î«ü¬£±Ôz¨Ó©I¥s¤èªkµ{§Ç¡G
cVariable = ObjectName.MethodName(cParameter, nParameter)
§t¤J¹w¥ý©w¸q±`¼Æ
¬°¤F¦b¤èªkµ{§Ç©Î¨Æ¥ó (Äݩʤ£¯à) ¤¤¨Ï¥Î¹w¥ý©w¸qªº±`¼Æ¡A¥i¦bªí³æ©Îªí³æ¶°¤¤¥Î #INCLUDE ©R¥O¥]§t¤@Ó¼ÐÀYÀɮסC¼ÐÀYÀɮפ@¯ë¥]§t¥Ñ #DEFINE «e¸m³B²z¾¹µêÀÀ©R¥O©w¸qªº½sĶ³sµ²®Éªº±`¼Æ¡C
Yn¦bªí³æ¤¤§t¤JÀÉ®×
1.±q [ªí³æ] ¥\¯àªí¤¤¿ï©w [§t¤JÀÉ®×]¡C
2.¦b [§t¤JÀÉ®×] ¹ï¸Ü¤è¶ôªº [§t¤JÀÉ®×] ¤å¦r¿é¤J¤è¶ô¤¤«ü©wÀɮסC
¡Ð©ÎªÌ¡Ð
¿ï©w¹ï¸Ü¤è¶ô«ö¶s¥H¶}±Ò [§t¤J] ¹ï¸Ü¤è¶ô¨Ã³Q¿ï©wÀɮסC
3.¿ï¨ú [½T©w] «ö¶s¡C
¬ÛÃö¸ê°T
¦bªí³æ¤¤·s¼Wª«¥ó
¦p¦ó¡G¦bªí³æ¤¤·s¼W¨Ï¥ÎªÌ¦Ûqª«¥ó
³B²zª«¥ó
«Ø¥ßªí³æ
±±¨îªí³æ¦æ¬°
¦p¦ó¡G½s¿è¨Æ¥ó©M¤èªkµ{§Çªºµ{¦¡½X
----------------------------------------------------------------------------------------------
ì¤å¡G
How to: Add Properties and Methods to a Form
You can add as many new properties and methods as you want to a form set or to a form that isn't part of a form set. Properties hold a value; methods hold procedural code to be run when you call the method. The new properties and methods are scoped to the form and you reference them the same way you reference other properties or methods of the form.
Creating New Properties
If you have a form set, properties and methods that you add in the Form Designer are scoped to the form set. If you don't have a form set, the properties and methods are scoped to the form.
To add a new property to a form
1.From the Form menu, choose New Property.
2.In the New Property Dialog Box, type the name of the property. You can also include a description of the property that can be displayed at the bottom of the Properties window.
Creating an Array Property
An array property is scoped to the form like any other property, but can be manipulated with the Visual FoxPro array commands and functions.
To create an array property
1.Add a new property to the form.
2.In the Name box of the New Property Dialog Box, type the name of the array property and include the size and dimensions of the array.
For example, to create a two-dimensional array with 10 rows, you could type arrayprop[10,2] in the Name box of the New Property dialog box.
Array properties are read-only in design mode, but you can manage, redimension, and assign values to the elements of the array property at run time. For an example of using an array property, see How to: Manage Multiple Instances of a Form.
Creating New Methods
You can add methods to the form that can be called the same way the form class methods can be called.
To create a new method for a form
1.From the Form menu, choose New Method.
2.In the New Method Dialog Box, type the name of the method. You can optionally include a description of the method.
You call a user-defined method the same way you call base class methods, using the following syntax:
ObjectName.MethodName
Your method can also accept parameters and return values. In this case, you call the method in an assignment statement:
cVariable = ObjectName.MethodName(cParameter, nParameter)
Including Predefined Constants
To use predefined constants in your methods or events (not to properties), you can include a header file in a form or a form set using #INCLUDE. A header file typically contains compile-time constants defined with the #DEFINE preprocessor directive.
To include a file in a form
1.From the Form menu, choose Include File.
2.In the Include File Dialog Box, specify the file in the Include File text box.
-or-
Choose the dialog button to open the Include dialog box and choose the file.
3.Choose OK.
See Also
Adding Objects to Forms
How to: Add User-Defined Objects to a Form
Manipulating Objects
Creating Forms
Controlling Form Behavior
How to: Edit Event and Method Code _________________ §Æ±æ¦³§ó¦h¤H¨Ó°Ñ»P
VFP wiki - »Ýn¤j®a¤@°_§¹¦¨ªºVFP¹q¤l®Ñ»PFAQ |
|
¦^³»ºÝ |
|
|
¦¶¨|¿³
µù¥U®É¶¡: 2003-08-25 ¤å³¹: 661 ¨Ó¦Û: ¥x¤¤¥«¤j¨½°Ï
²Ä 176 ¼Ó
|
µoªí©ó: ¬P´Á¤@ ¤Q¤G¤ë 27, 2004 9:58 pm ¤å³¹¥DÃD: |
|
|
±±¨îªí³æ¦æ¬°¡@
·í±z¦b [ªí³æ³]p¤u¨ã] ¤¤³]pªí³æ®É¡Aªí³æ¬O§@¥Îªº¡G°£«D Visible Äݩʳ]©w¬°°² (.F.)¡A±z¹ïªí³æªº¥~Æ[©M¦æ¬°ªº×§ï±N¥ß¨è¦bªí³æ¤W¤ÏÀ³¥X¨Ó¡C¦pªG±N WindowState Äݩʳ]©w¬° 1 ¡X ³Ì¤p¤Æ©Î 2 ¡X ³Ì¤j¤Æ¡A[ªí³æ³]p¤u¨ã] ¤¤ªºªí³æ·|¥ß§Y¤ÏÀ³³o¤@³]©w¡C¦pªG±N Movable Äݩʳ]©w¬°°² (.F.)¡A¨º»ò¤£¦ý¨Ï¥ÎªÌ¦b°õ¦æ®É´ÁµLªk²¾°Êªí³æ¡A§Y¨Ï¦b³]p®É´Á¤]µLªk²¾°Ê¥¦¡C¦]¦¹±zÀ³¸Ó¦b³]©w¨º¨Ç¨M©wªí³æ¦æ¬°ªºÄݩʤ§«e¡A¥ý§¹¦¨ªí³æªº¥\¯à³]p¡A¨Ã·s¼W©Ò¦³»Ýnªº±±¨î¶µ¡C
¤Uªí¦C¥X¤F¦b³]p®É´Á±`¥Îªºªí³æÄÝ©Ê¡A¥¦Ì©w¸q¤Fªí³æªº¥~Æ[©M¦æ¬°¡C
------------------------------------------------------------------------------------------------------
ÄÝ©Ê¡@¡@¡@¡@´yz¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¹w³]È
----------- ------------------------------------------------------------------------- -----------
AlwaysOnTop ±±¨îªí³æ¬O§_Á`¬O³B¦b¨ä¥L¶}±Òªºµøµ¡¤§¤W¡C¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@°² (.F.)
AutoCenter¡@±±¨îªí³æ°_©l¤Æ®É¬O§_Åýªí³æ¦Û°Ê¦a¦b Visual FoxPro ®à±µøµ¡¤¤©Î®à±¤W¸m¤¤¡C °² (.F.)
BackColor¡@ ¨M©wªí³æµøµ¡ªºÃC¦â¡C¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@255,255,255
BorderStyle ±±¨îªí³æ¬O¨S¦³Ãä®Ø¡AÁÙ¬O¨ã¦³³æ½uÃä®Ø¡BÂù½uÃä®Ø©Î¥i½ÕÃä®Ø¡C¡@¡@¡@¡@¡@¡@¡@¡@3
¡@¡@¡@¡@¡@¡@¦pªG BorderStyle ¬° 3 ¡X ¥i½ÕÃä®Ø¡A¨Ï¥ÎªÌ´N¯à«·s§ïÅܪí³æ¤j¤p¡C
Caption¡@¡@ ¨M©wªí³æ¼ÐÃD¦CÅã¥Üªº¤å¦r¡C¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@Form1
Closable¡@¡@±±¨î¨Ï¥ÎªÌ¬O§_¯à³z¹L«ö¨â¤U [Ãö³¬] ¤è¶ô¨ÓÃö³¬ªí³æ¡C¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¯u (.T.)
DataSession ±±¨îªí³æ¤¤ªº¸ê®Æªí®æ¬O¦b¥þ°ì³£¯à¦s¨úÁÙ¬O¦bªí³æ¤¤¨p¦³ªº¤u§@°Ï¤¤¶}±Ò¡C¡@¡@¡@1
MaxButton¡@ ±±¨îªí³æ¬O§_¨ã¦³ [³Ì¤j¤Æ] «ö¶s¡C¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¯u (.T.)
MinButton¡@ ±±¨îªí³æ¬O§_¨ã¦³ [³Ì¤p¤Æ] «ö¶s¡C¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¯u (.T.)
Movable¡@¡@ ±±¨îªí³æ¬O§_¯à²¾°Ê¨ì¿Ã¹õ¤Wªº·s¦ì¸m¡C¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¯u (.T.)
ScaleMode¡@ ±±¨îª«¥óªº¤Ø¤o©M¦ì¸mÄݩʪº´ú¶q³æ¦ì¬O foxel ÁÙ¬O¹³¯À¡C¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@ ¥Ñ [¿ï¶µ] ¹ï¸Ü¤è
¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¶ô¤¤ªº³]©w¨M©w¡C
Scrollbars¡@±±¨îªí³æ©Ò¨ã¦³ªº±²¶bÃþ«¬¡C¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@0 - µL
TitleBar¡@¡@±±¨î¼ÐÃD¦C¬O§_nÅã¥Ü¦bªí³æªº³»ºÝ¡C¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@1 - ¶}±Ò
ShowWindow¡@±±¨îµøµ¡¬O§_¬O¤lµøµ¡ (¦b¿Ã¹õ¤¤)¡B¯B°Êµøµ¡©Î³Ì³»¼h¤§µøµ¡¡C¡@¡@¡@¡@¡@¡@¡@¡@ 0 - ¦b¿Ã¹õ¤¤
WindowState ±±¨îªí³æ¬O³Ì¤p¤Æ (¶È¦bµøµ¡¤¤)¡B³Ì¤j¤ÆÁÙ¬O¼Ð·Çª¬ºA¡C¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@ 0 - ¼Ð·Ç
WindowType¡@±±¨îªí³æ¬O«D±j¨î¦^À³ªí³æ (¹w³]) ÁÙ¬O±j¨î¦^À³ªí³æ¡C¦pªGªí³æ¬O±j¨î¦^À³¡A¡@¡@0 ¡V «D±j¨î¦^À³
¡@¡@¡@¡@¡@¡@¨Ï¥ÎªÌ¦b¦s¨úÀ³¥Îµ{¦¡ªº¨Ï¥ÎªÌ¬É±¤¤¥ô¦ó¨ä¥L¤¸¯À«e¥²¶·Ãö³¬³oÓªí³æ¡C
------------------------------------------------------------------------------------------------------
±z¥i¥H¨Ï¥Î LockScreen ÄÝ©Ê¡A¨Ï±±¨î¶µ°t¸mÄݩʦb°õ¦æ®É´Áªº½Õ¾ã¬Ý°_¨Ó§ó²M´·¡C
¬ÛÃö¸ê°T
¦p¦ó¡G¦bªí³æ¤¤¥[¤JÄÝ©Ê©M¤èªkµ{§Ç
¦p¦ó¡G«ü©wªí³æªº¹Ï¥Ü
³B²zª«¥ó
¦p¦ó¡G½s¿è¨Æ¥ó©M¤èªkµ{§Çªºµ{¦¡½X
«Ø¥ßªí³æ
[ªí³æ³]p¤u¨ã]
Visible ÄÝ©Ê (Visual FoxPro)
¦p¦ó¡GÀx¦sªí³æ¡@
----------------------------------------------------------------------------------------------
ì¤å¡G
Controlling Form Behavior¡@
When you are designing a form in the Form Designer, the form is live: except for setting the Visible property to false (.F.), visual and behavioral changes you make are immediately reflected in the form. If you set the WindowState property to 1 ¡V Minimized or 2 ¡V Maximized, the form in the Form Designer immediately reflects this setting. If you set the Movable property to false (.F.), a user will not be able to move the form at run time and you won't be able to move the form at design time either. You might want to design the functionality of your form and add all the appropriate controls before you set some of the properties that determine form behavior.
The following form properties are commonly set at design time to define the appearance and behavior of the form.
-----------------------------------------------------------------------------------------------------
Property¡@¡@ Description¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@Default
----------- --------------------------------------------------------------- -------------------------
AlwaysOnTop Controls whether a form is always on top of other open windows. False (.F.)
AutoCenter¡@Controls whether the form is automatically centered in the main False (.F.)
¡@¡@¡@¡@¡@¡@Visual FoxPro window or on the desktop when the form is
¡@¡@¡@¡@¡@¡@initialized.
BackColor¡@ Determines the color of the form window.¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@255,255,255
BorderStyle Controls whether the form has no border, a single-line border,¡@3
¡@¡@¡@¡@¡@¡@a double-wide border, or a system border. If the BorderStyle
¡@¡@¡@¡@¡@¡@is 3 - System, the user will be able to resize the form.
Caption¡@¡@ Determines the text displayed in the title bar of the form.¡@¡@ Form1
Closable¡@¡@Controls whether the user can close the form by double-clicking True (.T.)
¡@¡@¡@¡@¡@¡@the close box.
DataSession Controls whether the tables in the form are opened in work¡@¡@¡@1
¡@¡@¡@¡@¡@¡@areas that are globally accessible or private to the form.
MaxButton¡@ Controls whether or not the form has a maximize button.¡@¡@¡@¡@ True (.T.)
MinButton¡@ Controls whether or not the form has a minimize button.¡@¡@¡@¡@ True (.T.)
Movable¡@¡@ Controls whether or not the form can be moved to a new¡@¡@¡@¡@¡@True (.T.)
¡@¡@¡@¡@¡@¡@location on the screen.
ScaleMode¡@ Controls whether the unit of measurement in object size and¡@¡@ Determined by settings in
¡@¡@¡@¡@¡@¡@position properties is foxels or pixels.¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@the Options dialog box.
Scrollbars¡@Controls the type of scroll bars a form has.¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@0 - None
TitleBar¡@¡@Controls whether a title bar appears at the top of the form.¡@¡@1 - On
ShowWindow¡@Controls whether the window is a child (in screen), floating,¡@ 0 - In Screen
¡@¡@¡@¡@¡@¡@or top-level window.
WindowState Controls whether the form is minimized (in Windows only),¡@¡@¡@ 0 - Normal
¡@¡@¡@¡@¡@¡@maximized, or normal.
WindowType¡@Controls whether the form is modeless (the default) or modal.¡@ 0 ¡V Modeless
¡@¡@¡@¡@¡@¡@If the form is modal, the user must close the form before
¡@¡@¡@¡@¡@¡@accessing any other elements of your application's user
¡@¡@¡@¡@¡@¡@interface.
-----------------------------------------------------------------------------------------------------
You can use the LockScreen property to make run-time adjustment of control layout properties appear cleaner.
See Also
How to: Add Properties and Methods to a Form
How to: Assign an Icon to a Form
Manipulating Objects
How to: Edit Event and Method Code
Creating Forms
Form Designer
Visible Property (Visual FoxPro)
How to: Save Forms _________________ §Æ±æ¦³§ó¦h¤H¨Ó°Ñ»P
VFP wiki - »Ýn¤j®a¤@°_§¹¦¨ªºVFP¹q¤l®Ñ»PFAQ |
|
¦^³»ºÝ |
|
|
¦¶¨|¿³
µù¥U®É¶¡: 2003-08-25 ¤å³¹: 661 ¨Ó¦Û: ¥x¤¤¥«¤j¨½°Ï
²Ä 177 ¼Ó
|
µoªí©ó: ¬P´Á¤T ¤Q¤G¤ë 29, 2004 12:15 am ¤å³¹¥DÃD: |
|
|
¦p¦ó¡G½s¿è¨Æ¥ó©M¤èªkµ{§Çªºµ{¦¡½X
¨Æ¥ó¬O¨Ï¥ÎªÌªº¦æ¬°¡A¦p«ö¤@¤U·Æ¹«©Î·Æ¹«ªº²¾°Ê¡A¤]¥i¥H¬O¨t²Î¦æ¬°¡A¦p¨t²Î¤p®ÉÄÁªº³B²z¡C¤èªkµ{§Ç¬O©Mª«¥ó¬ÛÁpôªºµ{§Ç¡A¥u¯à³z¹Lµ{¦¡¥H¯S©wªº¼Ò¦¡±Ò°Ê¡C¦³Ãö¨Æ¥ó©M¤èªkµ{§Çªº°Q½×¡A½Ð°Ñ¾\¡uª«¥ó¾É¦Vµ{¦¡³]p¡v¡C·íIJµo¨Æ¥ó©Î±Ò°Ê¤èªkµ{§Ç®É¡A±z¥i¥H«ü©wn°õ¦æªºµ{¦¡½X¡C
Yn½s¿è¨Æ¥ó©Î¤èªkµ{§Çªºµ{¦¡½X
1.±q [À˵ø] ¥\¯àªí¤¤¿ï©w [µ{¦¡½X] ©R¥O¡C
2.¦b [µ{§Ç] ¤è¶ô¤¤¿ï©w¨Æ¥ó©Î¤èªkµ{§Ç¡C
3.¦b [½s¿è] µøµ¡¤¤¼g¤Jµ{¦¡½X¡A¦bIJµo¨Æ¥ó©Î±Ò°Ê¤èªkµ{§Ç®É±N°õ¦æ³o¨Çµ{¦¡½X¡C
¨Ò¦p¡A¦pªG¦bªí³æ¤W¬J¦sªº¤@Ó¼ÐÃD¬° [µ²§ô] ªº«ü¥O«ö¶s¡A¦b³oÓ«ö¶sªº Click ¨Æ¥ó¤¤¥i¥]¬A³o¼Ë¤@¦æµ{¦¡½X¡G
THISFORM.Release
´£¥Ü¡G
Yn¦b [µ{¦¡½X½s¿è] µøµ¡¤¤À˵ø¤£¦Pµ{§Ç¡A½Ð«ö PgDn ©Î PgUp Áä¡C
·í¨Ï¥ÎªÌ«ö¤@¤U³oÓ«ü¥O«ö¶s®É¡Aªí³æ·|±q¿Ã¹õ©M°O¾ÐÅ餤²¾°£¡C¦pªG¤£·Q±q°O¾ÐÅ餤ÄÀ©ñªí³æ¡A¥i¦b click ¨Æ¥ó¤¤¥H³o¼Ë¤@¦æµ{¦¡½X´À¥N¡G
THISFORM.Hide
ª`·N¡G
¦pªGªí³æ¶°¡Bªí³æ©Îªí³æ¶°ªº¥ô¦óªí³æ¤W¤§¥ô¦óª«¥óªº Init ¨Æ¥óµ{§Ç¶Ç¦^°² (.F.)¡A´NµLªk«Ø¥ß³oÓªí³æ¡C
¬ÛÃö¸ê°T
¦p¦ó¡G¦bªí³æ¤¤¥[¤JÄÝ©Ê©M¤èªkµ{§Ç
±±¨îªí³æ¦æ¬°
¦p¦ó¡GÀx¦sªí³æ
«Ø¥ßªí³æ
¦p¦ó¡G°õ¦æªí³æ
¦p¦ó¡G¦b°õ¦æ®É´Á³]©wÄÝ©Ê
----------------------------------------------------------------------------------------------
ì¤å¡G
How to: Edit Event and Method Code
Events are user actions, such as clicks and mouse movements, or system actions, such as the progression of the system clock. Methods are procedures that are associated with the object and that are specifically invoked programmatically. For a discussion of events and methods, see Object-Oriented Programming. You can specify the code to be processed when an event is triggered or a method is invoked.
To edit event or method code
1.From the View menu, choose Code.
2.Select the event or method in the Procedure box.
3.In the Edit window, write the code you want to be processed when the event is triggered or the method is invoked.
For example, you could have a command button on a form with the caption "Quit." In the Click event for the button, include the line:
THISFORM.Release
Tip:
To move between procedures in the Code Editing window, press PAGE DOWN or PAGE UP.
When the user clicks the command button, the form is removed from the screen and from memory. If you don't want to release the form from memory, you could instead include the following line in the click event:
THISFORM.Hide
Note:
If code associated with the Init event of a form set, a form, or any object on any form in a form set returns false (.F.), the form will not be created.
See Also
How to: Add Properties and Methods to a Form
Controlling Form Behavior
How to: Save Forms
Creating Forms
How to: Run a Form
How to: Set Properties at Run Time _________________ §Æ±æ¦³§ó¦h¤H¨Ó°Ñ»P
VFP wiki - »Ýn¤j®a¤@°_§¹¦¨ªºVFP¹q¤l®Ñ»PFAQ |
|
¦^³»ºÝ |
|
|
¦¶¨|¿³
µù¥U®É¶¡: 2003-08-25 ¤å³¹: 661 ¨Ó¦Û: ¥x¤¤¥«¤j¨½°Ï
²Ä 178 ¼Ó
|
µoªí©ó: ¬P´Á¥| ¤Q¤G¤ë 30, 2004 12:28 am ¤å³¹¥DÃD: |
|
|
¦p¦ó¡G°õ¦æªí³æ
±z¥i¥H±q¬É±ª½±µ°õ¦æªí³æ¡A©Î¦bµ{¦¡½X¤¤°õ¦æªí³æ¡C
¥æ½Í¤è¦¡¦a°õ¦æªí³æ
¦³´XºØ¤èªk°õ¦æ³]p¦nªºªí³æ¡C
¦pªG¦b [ªí³æ³]p¤u¨ã] ¤¤¤u§@¡A¥i³z¹L«ö¤@¤U [ªí³æ³]p¤u¨ã] ¤u¨ã¦C¤¤ªº [°õ¦æ] «ö¶s´ú¸Õªí³æ¡C¦pªG·Q¦b [ªí³æ³]p¤u¨ã] «·s¶}±Òªí³æ¡A½ÐÃö³¬°õ¦æªí³æ©ÎªÌ¦b¤u¨ã¦C¤W¿ï©w [קïªí³æ] «ö¶s¡C
±z¤]¥i¥H±q±M®×¤¤°õ¦æªí³æ¡A©ÎªÌ¥Hµ{¦¡¼¶¼g¼Ò¦¡°õ¦æ¥¦¡C
Yn°õ¦æªí³æ
1.¦b [±M®×ºÞ²zû] µøµ¡¤¤¡A±q [¤å¥ó] ¼ÐÅÒ¤º¿ï¨úªí³æ¦WºÙ¡AµM«á¿ï¨ú [°õ¦æ]¡C
¡Ð©ÎªÌ¡Ð
2.¦b [©R¥O] µøµ¡¤¤¡A¨Ï¥Î DO FORM ©R¥O°õ¦æªí³æ¡C
¡Ð©ÎªÌ¡Ð
3.±q [ªí³æ] ¥\¯àªí¤¤¿ï¨ú [°õ¦æªí³æ]¡C±z¤]¥i¥H¦b [¼Ð·Ç] ¤u¨ã¦C¤W¿ï¨ú [°õ¦æ] «ö¶s¡C
±z¤]¥i¥H±q [µ{¦¡] ¥\¯àªí¤¤¿ï©w [°õ¦æ] ¨Ó°õ¦æªí³æ¡A¦b [ÀÉ®×Ãþ«¬] ¤è¶ô¤¤¿ï©w [ªí³æ]¡A¿ï¨ú¤@Óªí³æ¦A¿ï¨ú [°õ¦æ] «ö¶s¡C
´£¥Ü¡G
°õ¦æªí³æ®É¡A³z¹L«ö¤@¤U [¼Ð·Ç] ¤u¨ã¦C¤Wªº [קïªí³æ] «ö¶s¡A¥i§Ö³t¤Á´«¨ì³]p¼Ò¦¡¡C
Y·Q¦bµ{¦¡¤¤°õ¦æªí³æ¡A»Ýn¦b»P¨Æ¥ó¬ÛÃö³sªºµ{¦¡½X¡B¤èªkµ{§Ç©Î¦bµ{¦¡©Îµ{§Ç¤¤¥]§t DO FORM ©R¥O¡C
¬°ªí³æª«¥ó©R¦W
¹w³]±¡ªp¤U¡A·í¨Ï¥Î DO FORM ©R¥O®É¡Aªí³æª«¥óªº¦WºÙ»P .scx ÀɮצWºÙ¤@¼Ë¡C¨Ò¦p¡A¤U±ªº¤@¦æµ{¦¡½X°õ¦æ Customer.scx¡CVisual FoxPro ¦Û°Ê¬°³oÓªí³æ«Ø¥ß¤@Ó¦W¬° customer ªºª«¥óÅܼơG
DO FORM Customer
Yn©R¦Wªí³æª«¥ó
¡E½Ð¨Ï¥Î DO FORM ©R¥Oªº NAME ¤l¥y¡C
¨Ò¦p¡A¤U±ªº©R¥O°õ¦æ¤@Óªí³æ¡A¦P®É«Ø¥ß¨âÓªí³æª«¥óÅܼƦWºÙ¡G
DO FORM Customer NAME frmCust1
DO FORM Customer NAME frmCust2
³B²zªí³æª«¥ó
±z¥i¥H¨Ï¥Î¤@Ó¤½¦@ÅܼƩMªí³æª«¥ó¬ÛÃö³s¡A¥i¥H³z¹L³oÓÅܼƦWºÙ¨Ó¦s¨úªí³æª«¥ó¡C
¦p¦ó¨Ï¥Î¤@Ó¤½¦@ÅܼƩMªí³æª«¥ó¬ÛÃö³s
¡E¦b [©R¥O] µøµ¡¨Ï¥Î DO FORM ©R¥O¡C
¨Ò¦p¡A¦b [©R¥O] µøµ¡°õ¦æ¤U±ªº©R¥O¡A¶}±Ò¤@Ó¦W¬° Customer ªºªí³æ¨Ã§ïÅÜ¥¦ªº¼ÐÃD¡C
DO FORM Customer
Customer.Caption = "Hello"
¦pªG¦b [©R¥O] µøµ¡°õ¦æ¤U±ªº©R¥O¡A¦b§@¥Î¿é¥Xµøµ¡¤¤±NÅã¥Ü O¡Aªí¥Ü Customer ¬O¤@Óª«¥ó¡G
? TYPE("Customer")
¦pªG¦bµ{¦¡¤¤°õ¦æ DO FORM ©R¥O¡Aªí³æª«¥ó§@¥Î½d³ò©ó³oÓµ{¦¡¡C¦pªGµ{¦¡©Îµ{§Ç°õ¦æµ²§ô¡A·|²¾°£ª«¥ó¡A¦ýªí³æ¤´µM¥i¨£¡C¨Ò¦p¡A±z¥i¥H°õ¦æ¤U±³oÓµ{¦¡¡G
*formtest.prg
DO FORM Customer
¦b°õ¦æ§¹µ{¦¡«á¡Aªí³æ¤´µM¥i¨£¡Aªí³æ¤Wªº©Ò¦³±±¨î¶µ¤´µM³B©ó¬¡°Êª¬ºA¡A¦ý TYPE("Customer") ¶Ç¦^ U ªí¥Ü Customer ¬O¨S¦³©w¸qªºÅܼơC¦]¦¹¦b [©R¥O] µøµ¡¤¤°õ¦æ¤U±ªº©R¥O±N²£¥Í¿ù»~¡G
Customer.Caption = "Hello"
¦ý±zÁÙ¥i¥H¨Ï¥ÎÀ³¥Îµ{¦¡ª«¥óªº ActiveForm¡BForms ©M FormCount Äݩʦs¨úªí³æ¡C
±Nªí³æ³sµ²¨ìªí³æª«¥óÅܼÆ
±Nªí³æ©Mªí³æª«¥ó³sµ²°_¨Ó¡C
¦p¦ó±Nªí³æ©Mªí³æª«¥ó³sµ²°_¨Ó
¡E¨Ï¥Î DO FORM ©R¥O¤¤ªº LINKED ÃöÁä¦r¡C
¦pªG¥]§t¤F LINKED ÃöÁä¦r¡A·í»Pªí³æª«¥ó¬ÛÃö³sªºÅܼƶW¥X½d³ò®É¡Aªí³æ±N³QÄÀ©ñ¡C
¨Ò¦p¡A¤U±©R¥O«Ø¥ß¤@Ó³sµ²¨ìª«¥óÅÜ¼Æ frmCust2 ªºªí³æ¡G
DO FORM Customer NAME frmCust2 LINKED
·íÄÀ©ñ frmCust2 ®É¡Aªí³æ¤]Ãö³¬¡C
Ãö³¬¨Ï¥Î¤¤ªí³æ
Y·Q¤¹³\¨Ï¥ÎªÌ³z¹L«ö¤@¤UÃö³¬±±¨î¶µ«ö¶s¡A©Î¿ï¾Ü³oÓªí³æ±±¨î¶µªº¥\¯àªí¤¤ªº [Ãö³¬] ©R¥O¨ÓÃö³¬¨Ï¥Î¤¤ªí³æ¡A»Ýn³]©wªí³æªº Closable ÄÝ©Ê¡C
Yn¤¹³\¨Ï¥ÎªÌÃö³¬§@¥Îªí³æ
1.¦b [ÄÝ©Ê] µøµ¡¤¤¡A±N Closable Äݩʳ]©w¬°¯u (.T.)¡C
¡Ð©ÎªÌ¡Ð
2.¨Ï¥Î RELEASE ©R¥O¡C
¨Ò¦p¡A±z¥i¥H³z¹L¦b [©R¥O] µøµ¡ (Visual FoxPro) ©Îµ{¦¡¤¤°õ¦æ¤U±ªº©R¥O¨ÓÃö³¬©MÄÀ©ñªí³æ frmCustomer¡G
RELEASE frmCustomer
¤]¥i¥H¦b¤@Ó±±¨î¶µ¡A¤ñ¦p¼ÐÃD¬° [µ²§ô] ªº«ü¥O«ö¶sªº Click ¨Æ¥óµ{¦¡½X¤¤¥]§t¤U±ªº©R¥O¡A¥¦¤¹³\¨Ï¥ÎªÌÃö³¬©MÄÀ©ñªí³æ¡G
THISFORM.Release
¥i¥H¦b»Pªí³æ¤Wªºª«¥ó¬ÛÃö³sªºµ{¦¡½X¤¤¨Ï¥Î RELEASE ©R¥O¡A¦ý¦b Release ¤èªkµ{§Ç¤¤«o¤£·|°õ¦æ¥]§tªº¥ô¦óµ{¦¡½X¡C
ĵ§i¡G
·íÄÀ©ñªí³æ®É¡A¦P®É¤]±q°O¾ÐÅ餤ÄÀ©ñ¤F¬°³oÓªí³æ«Ø¥ßªºª«¥óÅܼơC¨C¤@Óªí³æ¶°¦³¤@Ó³æ¿WªºÅܼơA¦]¦¹¤£ÄÀ©ñªí³æ¶°´NµLªkÄÀ©ñªí³æ¶°¤¤ªºªí³æ¡C¦pªG·QnÄÀ©ñªí³æ¶°¡A¥i¨Ï¥Î RELEASE THISFORMSET ©R¥O¡C¦pªG·Q±N¤@Óªí³æ±q¿Ã¹õ²¾°£¡A¤£¦AÅý¨Ï¥ÎªÌ¬Ý¨£©Î¨Ï¥Î¥¦¡A¥i¥H¨Ï¥Î THISFORM.Hide ©R¥O¡C
¬ÛÃö¸ê°T
³B²zªí³æ
¦p¦ó¡GÀx¦sªí³æ
¦p¦ó¡G¦b°õ¦æ®É´Á³]©wÄÝ©Ê
«Ø¥ßªí³æ
³B²zª«¥ó½d¨Ò
¦p¦ó¡GÁôÂêí³æ
----------------------------------------------------------------------------------------------
ì¤å¡G
How to: Run a Form
You can run a form directly from the interface or in program code.
Running a Form Interactively
There are several ways to run the form you've designed.
If you're working in the Form Designer, you can test the form by clicking the Run button on the Form Designer toolbar. To reopen the form in the Form Designer, close the form or choose the Modify Form button on the toolbar.
You can also run a form from a project or programmatically.
To run a form
1.In the Project Manager Window, select the select the name of the form under the Documents tab and choose Run.
-or-
2.Type "DO FORM" in the Command window.
-or-
3.From the Formmenu, choose Run Form. You can also choose the Run button on the Standard toolbar.
You can also run the form by choosing Do from the Program menu, choosing Form in the List Files of Type box, selecting the form, and choosing Do.
Tip:
When running a form, you can quickly switch to Design mode by clicking the Modify Form button on the Standard toolbar.
To run a form from a program, include the DO FORM Command in the code associated with an event, in method code, or in a program or procedure.
Naming the Form Object
By default, when you use the DO FORM command, the name of the form object is the same as the name of the .scx file. For example, the following line of code runs Customer.scx. Visual FoxPro automatically creates an object variable for the form named customer:
DO FORM Customer
To name a form object
¡EUse the NAME clause of the DO FORM command.
For example, the following commands run a form, creating two form object variable names:
DO FORM Customer NAME frmCust1
DO FORM Customer NAME frmCust2
Manipulating the Form Object
You can associate a form object with a public variable so that you can access the form object through the variable name.
To associate a form object with a public variable
¡EUse the DO FORM command in the Command window.
For example, the following commands, issued in the Command window, open a form named Customer and change its caption.
DO FORM Customer
Customer.Caption = "Hello"
If you then issue the following command in the Command window, O is displayed in the active output window, indicating that Customer is an object:
? TYPE("Customer")
If you issue the DO FORM command in a program, the form object is scoped to the program. If the program or procedure completes, the object is gone, but the form remains visible. For example, you could run the following program:
*formtest.prg
DO FORM Customer
After you run the program, the form remains visible and all of the controls on the form are active, but TYPE("Customer") returns U indicating that Customer is an undefined variable. The following command, issued in the Command window, would generate an error:
Customer.Caption = "Hello"
You can, however, access the form by using the ActiveForm, Forms, and FormCount properties of the application object.
Scoping the Form to the Form Object Variable
You can link a form to a form object.
To link a form to a form object
¡EUse the DO FORM command with the LINKED keyword.
If you include the LINKED keyword, when the variable associated with the form object goes out of scope, the form is released.
For example, the following command creates a form linked to the object variable frmCust2:
DO FORM Customer NAME frmCust2 LINKED
When frmCust2 is released, the form is closed.
Closing an Active Form
To allow users to close the active form by clicking the close button or by choosing Close from the form's Control menu, set the Closable property of the form.
To allow a user to close the active form
1.In the Properties window, set the Closable Property to true (.T.).
-or-
2.Use the RELEASE Command.
For example, you can close and release the frmCustomer form by issuing the following command in a program or in the Command Window (Visual FoxPro):
RELEASE frmCustomer
You can also allow a user to close and release a form by including the following command in the Click Event code for a control, such as a command button with a caption of "Quit":
THISFORM.Release
You can also use the RELEASE command in the code associated with an object on the form, but any code you've included in the Release Method will not be executed.
Caution:
When you release a form, you release from memory the object variable created for the form. There is a single variable for a form set, so you can't release forms in a form set without releasing the form set. If you want to release the form set, you can use RELEASE THISFORMSET. If you want to remove a form from the screen so that a user can no longer see it or interact with it, you can use THISFORM.Hide.
See Also
Working with Forms
How to: Save Forms
How to: Set Properties at Run Time
Creating Forms
Example of Manipulating Objects
How to: Hide a Form _________________ §Æ±æ¦³§ó¦h¤H¨Ó°Ñ»P
VFP wiki - »Ýn¤j®a¤@°_§¹¦¨ªºVFP¹q¤l®Ñ»PFAQ |
|
¦^³»ºÝ |
|
|
¦¶¨|¿³
µù¥U®É¶¡: 2003-08-25 ¤å³¹: 661 ¨Ó¦Û: ¥x¤¤¥«¤j¨½°Ï
²Ä 179 ¼Ó
|
µoªí©ó: ¬P´Á¤ ¤Q¤G¤ë 31, 2004 12:07 am ¤å³¹¥DÃD: |
|
|
¦p¦ó¡G¦b°õ¦æ®É´Á³]©wÄÝ©Ê¡@
Visual FoxPro ¤¤ªºª«¥ó¼Ò¦¡¯àÅý±z¦b°õ¦æ®É´Á±±¨îªí³æªºÄÝ©Ê¡C
¦bª«¥ó¼h¦¸¤W°Ñ¦Òª«¥ó
Y·Q¦bµ{¦¡½X¤¤ºÞ²z¤@Óª«¥ó¡A»Ýn½T©w¥¦©M®e¾¹¼h¦¸ªºÃöÁp¡C¦b®e¾¹¼h¦¸ªº³Ì°ª¶¥ (¤]´N¬Oªí³æ©Îªí³æ¶°) »Ýn°Ñ¦Òª«¥óÅܼơC°£«D¨Ï¥Î DO FORM ©R¥O¤¤ªº NAME ¤l¥y¡A§_«hª«¥óÅܼƩMªí³æÀÉ®× (.scx) ¦³¬Û¦Pªº¦WºÙ¡C
YnºÞ²zÄÝ©Ê
¡E¦bµ{¦¡½X¤¤¡A¨Ï¥ÎÂI¸¹ (.) ¹Bºâ¤l°µ¬°¤À¹j²Å¸¹¨Ó°Ñ¦Òª«¥óÅܼơB±±¨î¶µ¡AµM«áÄÝ©Ê¡A¥B¨Ï¥Î¤U¦C®æ¦¡¡G
ª«¥óÅܼÆ.[ªí³æ.]±±¨î¶µ.ÄÝ©Ê = ³]©wÈ
¤Uªí¦C¥XªºÄÝ©Ê©ÎÃöÁä¦r¨Ï¦bª«¥ó¼h¦¸¤W°Ñ¦Òª«¥óÅܱo§ó®e©ö¡C
------------------------------------------
ÄÝ©Ê©ÎÃöÁä¦r¡@°Ñ¦Ò
------------- ----------------------------
ActiveControl ¥Ø«e§@¥Îªí³æ¤Wªº§@¥Î±±¨î¶µ¡C
ActiveForm¡@¡@¥Ø«e§@¥Îªí³æ¡C
ActivePage¡@¡@¥Ø«e§@¥Îªí³æ¤Wªº§@¥Î¶¡C
Parent¡@¡@¡@¡@ª«¥óªºª½±µ®e¾¹Ãþ§O¡C
THIS¡@¡@¡@¡@¡@ª«¥ó©Îª«¥óªºµ{§Ç©Î¨Æ¥ó¡C
THISFORM¡@¡@¡@¥]§tª«¥óªºªí³æ¡C
THISFORMSET¡@ §tª«¥óªºªí³æ¶°¡C
------------------------------------------
¨Ò¦p¡AYn§ïÅÜÀx¦s¦b Custivew.scx Àɮפ¤ªºªí³æ¶°¤¤ frmCust ªí³æªº¤@Ó«ü¥O«ö¶sªº¼ÐÃD¡A¥i¦bµ{¦¡¤¤©Î [©R¥O] µøµ¡¤¤¨Ï¥Î¤U±ªº©R¥O¡G
CustView.frmCust.cmdButton1.Caption = "½s¿è"
¥i¦bªí³æ©Îªí³æ¶°¤¤¨Ï¥Î THIS¡BTHISFORM ©M THISFORMSET ÃöÁä¦r¨Ó°Ñ¦Òª«¥ó¡C¨Ò¦p¡An·Q¦b«ö¤@¤U«ü¥O«ö¶s®É§ïÅÜ¥¦ªº¼ÐÃD¡A¥i¦b«ü¥O«ö¶sªº Click ¨Æ¥ó¤¤¥[¤J¤U±ªº©R¥O¡G
THIS.Caption = "½s¿è"
¤Uªí¦C¥X¤F¨Ï¥Î THISFORMSET¡BTHISFORM¡BTHIS ©M Parent ¨Ó³]©wª«¥óÄݩʪº½d¨Ò¡G
-------------------------------------------------------------------------------------------------------
©R¥O¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@ ¥]§t©R¥Oªº¦a¤è
-------------------------------------- ----------------------------------------------------------------
THISFORMSET.frm1.cmd1.Caption = '½T©w' ªí³æ¶°¤¤°£ frm1 ¤§¥~¥ô¦óªí³æ¤¤¥ô¦ó±±¨î¶µªº¨Æ¥ó©Î¤èªkµ{§Çµ{¦¡½X¡C
THISFORM.cmd1.Caption = '½T©w'¡@¡@¡@¡@ ©Ò¦bªí³æ¤¤°£ cmd1 ¤§¥~¥ô¦ó±±¨î¶µªº¨Æ¥ó©Î¤èªkµ{§Çµ{¦¡½X¡C
THIS.Caption = '½T©w'¡@¡@¡@¡@¡@¡@¡@¡@¡@·Qn§ïÅܨä¼ÐÃDªº±±¨î¶µªº¨Æ¥ó©Î¤èªkµ{§Çµ{¦¡½X¡C
THIS.Parent.BackColor = RGB(192,0,0)¡@ ªí³æ¤W¤@Ó±±¨î¶µªº¨Æ¥ó©Î¤èªkµ{§Çµ{¦¡½X¡C
¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@ ³oÓ©R¥O±Nªí³æªºI´ºÃC¦â§ï¬°·t¬õ¦â¡C
-------------------------------------------------------------------------------------------------------
¦b°õ¦æ®É´Á¨Ï¥Î¹Bºâ¦¡³]©wÄÝ©Ê
¦b°õ¦æ®É´Á¤]¥i¥H¨Ï¥Î¹Bºâ¦¡©Î¨ç¼Æ¨Ó³]©wÄÝ©Ê¡C
Yn¦b°õ¦æ®É´Á±NÄݩʳ]©w¬°¹Bºâ¦¡
1.¬°ÄÝ©Ê«ü©w¤@Ó¹Bºâ¦¡¡C
¡Ð©ÎªÌ¡Ð
2.¬°ÄÝ©Ê«ü©w¤@ӨϥΪ̦Ûq¨ç¼Æªºµ²ªG¡C
¨Ò¦p¡A®Ú¾Ú¤@ÓÅܼƪº¤£¦PÈ¡A¥i¥H±N¤@Ó«ö¶sªº¼ÐÃD³]©w¬° [½s¿è] ©Î [Àx¦s]¡Cº¥ý¦bªí³æªº©I¥sµ{¦¡¤¤«Å§i³oÓÅܼơG
PUBLIC glEditing
glEditing = .F.
µM«á¦b Caption ³]©w¤¤¨Ï¥Î¤@Ó IIF ¹Bºâ¦¡¡G
frsSet1.frmForm1.cmdButton1.Caption = IIF(glEditing = .F., "½s¿è", "Àx¦s")
¥i¥H¨M©w«ö¶sªº¤j¤p¡A¨Ï¥Î§t¦³¸ê®Æªí®æÄæ¦ìªº¹Bºâ¦¡³]©w¼ÐÃD¡G
* ±N«ö¶s¼e«×³]©w¬° '©I¥s ' ªº¼e«×¥[¤W©m¦Wªº¼e«×
frmForm1.cmdButton1.Width = 5 + ;
¡@ LEN(ALLTRIM(employee.first_name + " " + employee.last_name))
* ±N«ö¶s¼ÐÃD³]©w¬° '©I¥s '¥[¤W©m¦W
frmForm1.cmdButton1.Caption = "©I¥s " + ;
¡@ ALLTRIM(employee.first_name + " " + employee.last_name)
ÁÙ¥i¥H¥Î¤@ӨϥΪ̦Ûq¨ç¼Æ³]©w¼ÐÃD¡G
frsSet1.frmForm1.cmdButton1.Caption = setcaption()
³]©w¦hÓÄÝ©Ê
¥i¥H¦P®É³]©w¦hÓÄÝ©Ê¡C
Yn³]©w¦hÓÄÝ©Ê
¡E¨Ï¥Î WITH ... ENDWITH ©R¥Oµ²ºc¡C
¨Ò¦p¡An³]©wªí³æ¤¤¦hµ§½s¿è±±¨î¶µªºª½Ä檺¦hÓÄÝ©Ê¡A¥i¦bªí³æ¤¤¥ô¦ó¨Æ¥ó©Î¤èªkµ{§Çµ{¦¡½X¤¤¥]§t¤U±ªº±Ôz¡G
WITH THISFORM.grdGrid1.grcColumn1
¡@ .Width = 5
¡@ .Resizable = .F.
¡@ .ForeColor = RGB(0,0,0)
¡@ .BackColor = RGB(255,255,255)
¡@ .SelectOnEntry = .T.
ENDWITH
¦b°õ¦æ®É´Á©I¥s¤èªkµ{§Ç
«Ø¥ß¤Fª«¥ó¤§«á¡A±z´N¥i¥H¦bÀ³¥Îµ{¦¡ªº¥ô¦ó¦a¤è©I¥s³oÓª«¥óªº¤èªkµ{§Ç¡C
Yn©I¥sª«¥óªº¤èªkµ{§Ç
¡E¨Ï¥Î¤U¦C»yªk¡G
Parent.ª«¥ó.¤èªkµ{§Ç
¨Ò¦p¡A¤U±ªºµ{¦¡½X©I¥s¤èªkµ{§Ç¨ÓÅã¥Üªí³æ¡A¨Ã±NµJÂI«ü¦V¨ì¤@Ó«ü¥O«ö¶s¡G
* Àx¦s¦b MYF_SET.scx ¤¤ªºªí³æ¶°
myf_set.frmForm1.Show
myf_set.frmForm1.cmdButton1.SetFocus
YnÁôÂêí³æ¡A¨Ï¥Î³oÓ©R¥O¡G
myf_set.frmForm1.Hide
¬ÛÃö¸ê°T
³B²zªí³æ
¦p¦ó¡G°õ¦æªí³æ
«Ø¥ßªí³æ
¦p¦ó¡GÁôÂêí³æ
¦p¦ó¡G¶Ç»¼°Ñ¼Æµ¹ªí³æ
¦p¦ó¡G±Nªí³æ¦s¦¨ HTML Àɮס@
----------------------------------------------------------------------------------------------
ì¤å¡G
How to: Set Properties at Run Time¡@
The object model in Visual FoxPro makes it possible for you to control form properties at run time.
Referencing Objects in the Object Hierarchy
To manipulate an object in code, you need to identify it in relation to the container hierarchy. At the highest level of the container hierarchy, that is, the form or form set, you need to reference the object variable. Unless you use the NAME clause of the DO FORM Command, the object variable has the same name as the form (.scx) file.
To manipulate properties
¡EIn code, reference the object variable, the control, and then the property with the dot (.) operator as a separator and using the following format:
ObjectVariable.[Form.]Control.Property = Setting
The following table lists properties or keywords that make it easier to reference an object in the object hierarchy.
--------------------------------------------------------------------------------
Property or keyword References
------------------- ------------------------------------------------------------
ActiveControl¡@¡@¡@ The control on the currently active form that has the focus.
ActiveForm¡@¡@¡@¡@¡@The currently active form.
ActivePage¡@¡@¡@¡@¡@The active page on the currently active form.
Parent¡@¡@¡@¡@¡@¡@¡@The immediate container of the object
THIS¡@¡@¡@¡@¡@¡@¡@¡@The object or a procedure or event of the object.
THISFORM¡@¡@¡@¡@¡@¡@The form that contains the object.
THISFORMSET¡@¡@¡@¡@ The form set that contains the object.
--------------------------------------------------------------------------------
For example, to change the caption of a command button on the form frmCust in a form set stored in Custview.scx, use the following command in a program or in the Command window:
CustView.frmCust.cmdButton1.Caption = "Edit"
Use the THIS, THISFORM, and THISFORMSET keywords to reference objects from within a form. For example, to change the Caption of a command button when the command button is clicked, include the following command in the Click event code for the command button:
THIS.Caption = "Edit"
The following table gives examples of using THISFORMSET, THISFORM, THIS, and Parent to set object properties:
----------------------------------------------------------------------------------------------------
Command¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@Where to include the command
------------------------------------ ---------------------------------------------------------------
THISFORMSET.frm1.cmd1.Caption = 'OK' In the event or method code of any control on any form in the
¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@ form set except for frm1.
THISFORM.cmd1.Caption = 'OK'¡@¡@¡@¡@ In the event or method code of any control except for cmd1 on
¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@ the same form that cmd1 is on.
THIS.Caption = 'OK'¡@¡@¡@¡@¡@¡@¡@¡@¡@In the event or method code of the control whose caption you
¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@ want to change.
THIS.Parent.BackColor = RGB(192,0,0) In the event or method code of a control on a form. The command
¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@ changes the background color of the form to dark red.
----------------------------------------------------------------------------------------------------
Setting Properties at Run Time with Expressions
You can also set properties at run time using expressions or functions.
To set properties to expressions at run time
1.Assign an expression to the property.
-or-
2.Assign the result of a user-defined function to the property.
For example, you could set the caption of a button to be Edit or Save, depending on the value of a variable. Declare the variable in the calling program for your form:
PUBLIC glEditing
glEditing = .F.
Then use an IIF expression in the Caption setting:
frsSet1.frmForm1.cmdButton1.Caption = IIF(glEditing = .F., "Edit", "Save")
You could determine the size of a button and set the caption using expressions with fields in a table:
* set button width to length of 'Call ' + first and last names
frmForm1.cmdButton1.Width = 5 + ;
¡@ LEN(ALLTRIM(employee.first_name¡@¡@+ " " + employee.last_name))
* set button caption to 'Call ' + first and last names
frmForm1.cmdButton1.Caption = "Call " + ;
¡@ ALLTRIM(employee.first_name + " " + employee.last_name)
You could also set the caption using a user-defined function:
frsSet1.frmForm1.cmdButton1.Caption = setcaption()
Setting Multiple Properties
You can set multiple properties at once.
To set multiple properties
¡EUse the WITH ... ENDWITH Command structure.
For example, to set multiple properties of a column in a grid in a form, you could include the following statement in any event or method code in the form:
WITH THISFORM.grdGrid1.grcColumn1
¡@ .Width = 5
¡@ .Resizable = .F.
¡@ .ForeColor = RGB(0,0,0)
¡@ .BackColor = RGB(255,255,255)
¡@ .SelectOnEntry = .T.
ENDWITH
Calling Methods at Run Time
After an object is created, you can call the methods of that object from anywhere in your application.
To call a method for an object
¡EUse the following syntax:
Parent.Object.Method
For example, the following code calls methods to display a form and set the focus to a command button:
* form set saved in MYF_SET.SCX
myf_set.frmForm1.Show
myf_set.frmForm1.cmdButton1.SetFocus
To hide the form, issue this command:
myf_set.frmForm1.Hide
See Also
Working with Forms
How to: Run a Form
Creating Forms
How to: Hide a Form
How to: Pass Parameters to a Form
How to: Save a Form as HTML _________________ §Æ±æ¦³§ó¦h¤H¨Ó°Ñ»P
VFP wiki - »Ýn¤j®a¤@°_§¹¦¨ªºVFP¹q¤l®Ñ»PFAQ |
|
¦^³»ºÝ |
|
|
¦¶¨|¿³
µù¥U®É¶¡: 2003-08-25 ¤å³¹: 661 ¨Ó¦Û: ¥x¤¤¥«¤j¨½°Ï
²Ä 180 ¼Ó
|
µoªí©ó: ¬P´Á¤ ¤Q¤G¤ë 31, 2004 10:59 pm ¤å³¹¥DÃD: |
|
|
¦p¦ó¡GÁôÂêí³æ
±z¥i¥HÁôÂä@Óªí³æ¡A¨Ï¥¦¬Ý¤£¨£¡C¦bÁôÂêí³æ«á¡A¨Ï¥ÎªÌµLªk¦s¨úªí³æ¤Wªº±±¨î¶µ¡A¦ý±z¤´¥i¥H¥Îµ{¦¡§¹¥þ±±¨î¥¦Ì¡C
YnÁôÂêí³æ
¡E½Ð¨Ï¥Î Hide ¤èªkµ{§Ç¡C
¨Ò¦p¡A¦b»P«ü¥O«ö¶sªº Click ¨Æ¥ó¬ÛÃöªºµ{¦¡½X¤¤¡A±z¥i¥H¥]§t¤U±¤@¦æµ{¦¡½X¡G
THISFORM.Hide
·í¨Ï¥ÎªÌ«ö¤@¤U«ü¥O«ö¶s®É¡Aªí³æ¤´¦b°O¾ÐÅ餤¡A¦ý¤£¥i¨£¡C
ÄÀ©ñªí³æ
·í¨Ï¥ÎªÌ§¹¦¨¹ïªí³æªº°Ê§@«á¡A±z¥i¥HÅý¨Ï¥ÎªÌÄÀ©ñªí³æ¡C¦bÄÀ©ñªí³æ«á¡A±z´NµLªk¦A¦s¨úªí³æªºÄÝ©Ê©M¤èªkµ{§Ç¤F¡C
YnÄÀ©ñªí³æ
¡E½Ð©I¥s Release ¤èªkµ{§Ç¡C
¨Ò¦p¡A¦b»P«ü¥O«ö¶sªº Click ¨Æ¥ó¬ÛÃöªºµ{¦¡½X¤¤¡A±z¥i¥H¥]§t¤U±¤@¦æµ{¦¡½X¡G
THISFORM.Release
·í¨Ï¥ÎªÌ«ö¤@¤U«ü¥O«ö¶s®É¡Aªí³æ³QÃö³¬¡C
¬ÛÃö¸ê°T
³B²zªí³æ
³B²zª«¥ó½d¨Ò
«Ø¥ßªí³æ
¦p¦ó¡G¶Ç»¼°Ñ¼Æµ¹ªí³æ
¦p¦ó¡G±Nªí³æ¦s¦¨ HTML ÀÉ®×
¦p¦ó¡GºÞ²zªí³æªº¦hÓ®×¨Ò ¡@
----------------------------------------------------------------------------------------------
ì¤å¡G
How to: Hide a Form
You can hide a form so that it is not visible to a user. When the form is hidden, the user cannot interact with the form, but you still have full programmatic control of them.
To hide a form
¡EUse the Hide Method.
For example, in the code associated with the Click Event of a command button, you could include the following line of code:
THISFORM.Hide
When the user clicks the command button, the form remains in memory, but is not visible.
Releasing Forms
You can allow a user to release a form when he or she is finished interacting with it. When you release a form, you can no longer access properties and methods of the form.
To release a form
¡ECall the Release Method.
For example, in the code associated with the Click Event of a command button, you could include the following line of code:
THISFORM.Release
When the user clicks the command button, the form closes.
See Also
Working with Forms
Example of Manipulating Objects
Creating Forms
How to: Pass Parameters to a Form
How to: Save a Form as HTML
How to: Manage Multiple Instances of a Form _________________ §Æ±æ¦³§ó¦h¤H¨Ó°Ñ»P
VFP wiki - »Ýn¤j®a¤@°_§¹¦¨ªºVFP¹q¤l®Ñ»PFAQ |
|
¦^³»ºÝ |
|
|
|
|
±z µLªk ¦b³oÓª©±µoªí¤å³¹ ±z µLªk ¦b³oÓª©±¦^ÂФ峹 ±z µLªk ¦b³oÓª©±½s¿è¤å³¹ ±z µLªk ¦b³oÓª©±§R°£¤å³¹ ±z µLªk ¦b³oÓª©±¶i¦æ§ë²¼ ±z µLªk ¦b³oÓª©±ªþ¥[ÀÉ®× ±z µLªk ¦b³oÓª©±¤U¸üÀÉ®×
|
Powered by phpBB © 2001, 2005 phpBB Group ¥¿Å餤¤å»y¨t¥Ñ phpbb-tw ºûÅ@»s§@
|