VFP 愛用者社區 首頁 VFP 愛用者社區
本討論區為 Visual Foxpro 愛用者經驗交流的地方, 請多多利用"搜尋"的功能, 先查看看有無前例可循, 如果還有不懂的再發問. 部份主題有附加檔案, 須先註冊成為社區居民才可以下載.
 
 常見問題常見問題   搜尋搜尋   會員列表會員列表   會員群組會員群組   會員註冊會員註冊 
 個人資料個人資料   登入檢查您的私人訊息登入檢查您的私人訊息   登入登入

[翻譯] Chm For VFP9 Beta Release
前往頁面 上一頁  1, 2, 3 ... 10, 11, 12, 13, 14  下一頁
 
發表新主題   回覆主題    VFP 愛用者社區 首頁 -> VFP 討論區
上一篇主題 :: 下一篇主題  
發表人 內容
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 151 樓

發表發表於: 星期四 十二月 02, 2004 11:17 pm    文章主題: 引言回覆

如何:用表單集擴充表單


可以將多個表單包含在一個表單集中,作為一組處理。表單集有以下優點:

•可同時顯示或隱藏表單集中的所有的表單。
•可以視覺化的調整多個表單以控制它們的相對位置。
•因為表單集中所有表單都是在單一 .scx 檔案中用單獨的資料環境定義的,可自動地同步改變多個表單中的資料記錄指標。如果在一個表單的父資料表格中改變資料記錄指標,另一個表單中子資料表格的資料記錄指標則被更新和顯示。

注意:
執行表單集時,將載入表單集所有表單和表單的所有物件。載入帶著很多控制項的多個表單會花幾秒鐘的時間。



建立表單集

表單集是一個包含有一個或多個表單的父層次的容器物件。可在 [表單設計工具] 中建立表單集。


若要建立表單集

•從 [表單] 功能表中,選定 [建立表單集] 選項。

如果不需要將多個表單作為同一個表單組處理,則不必建立表單集。建立表單集以後,則可向其中加入表單。



新增和移除表單

建立了表單集以後,可新增表單或移除表單。


若要從表單集中新增表單

•從 [表單] 功能表中,選定 [加入新表單]。


若要從表單集中移除表單

1.在 [表單設計工具] 底部的 [表單] 方塊中,選擇要移除的表單。

2.從 [表單] 功能表中選定 [移除表單]。

如果表單集中只有一個表單,你可以將表單集移除而只剩下表單。


若要移除表單集

•從 [表單] 功能表中選定 [移除表單集]。

表單以資料表格的格式儲存在以 .scx 為副檔名的檔案中。建立一個表單時,.scx 資料表格包含了一筆表單的記錄,一個資料環境的記錄,和兩個內部使用記錄。Visual FoxPro 為每個新增到表單或資料環境中的物件新增一筆記錄。如果建立了表單集,則為表單集及每個新的表單新增一筆記錄。每個表單的父容器物件為表單集,每個控制項的父容器物件為其所在的表單。

提示:
當執行表單時,若不想在表單集中的所有表單的起始時就設定為顯示的。可以在表單集執行時期,將固定不顯示的表單的 Visible 屬性設定為假 (.F.)。要顯示的表單,Visible 屬性設定為真 (.T.)。



相關資訊

如何:在最頂層之表單中新增功能表

在表單中新增物件

建立表單

如何:新增 Visual FoxPro 容器控制項

[表單設計工具]




----------------------------------------------------------------------------------------------
原文:


How to: Extend Forms with Form Sets


You can manipulate multiple forms as a group by including them in a form set. A form set has these benefits:

•You can show or hide all the forms in a form set at one time.
•You can visually arrange multiple forms at once to control their relative positions.
•Because all the forms in a form set are defined in a single .scx file with a single data environment, you can automatically synchronize record pointers in multiple forms. If you change the record pointer in a parent table in one form, the child records in another form are updated and displayed.

Note:
All the forms and all the objects on the forms are loaded when you run the form set. Loading many forms with a number of controls might take several seconds.



Creating a New Form Set

A form set is a parent container for one or more forms. When you are in the Form Designer, you can create a form set.


To create a form set

•From the Form menu, choose Create Formset.

If you don't want to work with multiple forms as a group of forms, you don't need to create a form set. Once you've created a form set, you can add forms to it.



Adding and Removing Forms

Once you've created a form set, you can add new forms and remove forms.


To add additional forms to a form set

•From the Form menu, choose Add New Form.


To remove a form from a form set

1.In the Form box at the bottom of the Form Designer, select the form.

2.From the Form menu, choose Remove Form.

If you have a single form in a form set, you can remove the form set so that you have only the form.


To remove a form set

•From the Form menu, choose Remove Formset.

Forms are saved in table format to a file with an .scx extension. When you create a form, the .scx table contains a record for the form, a record for the data environment, and two records for internal use. A record is added for each object you add to the form or to the data environment. If you create a form set, an additional record is added for the form set and for each new form. The parent container of each form is the form set. The parent container of each control is the form that it is placed on.

Tip:
When you run a form set, you may not want all forms in the form set initially visible. Set the Visible property to false (.F.) for forms you don't want displayed when the form set runs. Set the Visible property to true (.T.) when you want the forms displayed.



See Also

How to: Add a Menu to a Top-Level Form

Adding Objects to Forms

Creating Forms

How to: Add Visual FoxPro Containers

Form Designer

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 152 樓

發表發表於: 星期五 十二月 03, 2004 11:12 pm    文章主題: 引言回覆

在表單中新增物件


為了在表單中設計所需的功能,您需要新增合適的控制項,設定表單和控制項屬性並撰寫程式碼。



在本章節中


深入瞭解容器控制項和控制項

介紹 Visual FoxPro 中的容器和控制項。


如何:新增 Visual FoxPro 容器控制項

說明如何在表單中加入各種基本容器。


如何:在表單中加入 Visual FoxPro 控制項

描述在 Visual FoxPro 表單中加入控制項的各種方法。


如何:使用 [元件陳列庫] 在表單中加入控制項

說明如何使用 [元件陳列庫] 在表單中迅速地加入自訂的控制項和物件。


如何:在一個用精靈產生的表單中加入控制項

說明如何從精靈控制項庫加入控制項到表單中,以便控制項符合由 [表單精靈] 建立的表單上的控制項的樣式。


如何:選取、移動以及調整表單控制項的大小

描述如何選取控制項並調整它的位置和大小。


如何:複製和移除表單控制項

描述如何複製一個已在表單上的控制項以及如何刪除現有的控制項。


對齊表單中的控制項

討論在表單上的控制項對齊的方法。


如何:設定控制項的 Tab 鍵遞移次序

描述如何在 [交談模式] 或 [按列表] 的表單上控制項設定 Tab 鍵遞移次序。


如何:在表單中新增使用者自訂物件

說明如何在表單中新增使用者自訂的自訂類別。



相關章節


如何:用表單集擴充表單

說明如何將多個表單包含在一個表單集中,作為一組處理。


建立表單

提供連結到描述如何建立表單。




----------------------------------------------------------------------------------------------
原文:


Adding Objects to Forms


To design the functionality you want in a form, you add the appropriate controls, set form and control properties, and write event code.



In This Section


Understanding Container and Control Objects

Introduces containers and controls in Visual FoxPro.


How to: Add Visual FoxPro Containers

Explains how to add the various base container classes to a form.


How to: Add Visual FoxPro Controls to a Form

Describes various methods to add controls to a Visual FoxPro form.


How to: Add Controls to a Form with the Component Gallery

Explains how to quickly add custom controls and objects to a form using the Component Gallery.


How to: Add Controls to a Wizard-Generated Form

Explains how to add controls from the wizard control gallery to a form so that they match the style of controls on a form created by one of the form wizards.


How to: Select, Move, and Resize Form Controls

Describes how to select a control to adjust its placement or size.


How to: Copy and Delete Form Controls

Describes how to make a copy of a control already on a form and how to delete existing controls.


Aligning Controls in Forms

Discusses ways to align controls on a form.


How to: Set Tab Order for Controls

Describes how to set the tab order for controls on a form interactively or by list.


How to: Add User-Defined Objects to a Form

Explains how to add user-defined custom classes to a form.



Related Sections


How to: Extend Forms with Form Sets

Explains how to manipulate multiple forms as a group by including them in a form set.


Creating Forms

Provides links that describe how to create forms.

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 153 樓

發表發表於: 星期六 十二月 04, 2004 11:35 pm    文章主題: 引言回覆

深入瞭解容器控制項和控制項


可以將下列型態的物件新增到表單:

•控制項
•容器類別
•使用者自訂類別
•共用資訊和新增 OLE

Visual FoxPro 中的物件依它們所根據類別的性質可分為兩類:

•容器類別可以容納其他的容器類別或控制項。它們可以作為其他物件的父物件。例如,一個表單作為一個容器類別,是放在它上面的核取方塊的父物件。
•控制項可以包含在容器類別中,但無法作為其他物件的父物件。例如,核取方塊就無法包含任何其他的物件。

在 [表單設計工具] 中既可以設計容器類別,也可以設計控制項。

-----------------------------------------------------------------------------------------
容器類別    可以包含
-------------- --------------------------------------------------------------------------
直欄      標題,以及除了表單集、表單、工具列、計時器和其他直欄控制項之外的任何控制項
指令按鈕組   指令按鈕
表單集     表單、工具列
表單      分頁框、多筆編輯控制項、任何控制項
多筆編輯控制項 直欄
選項按鈕組   選項按鈕
分頁框     頁面
頁面      多筆編輯控制項、任何控制項
-----------------------------------------------------------------------------------------



集合和計數屬性

Visual FoxPro 中的所有容器物件都有與它們相關聯的計數屬性和集合屬性。集合屬性是參考其每個被包含物件的陣列。計數屬性是指示其包含的物件數的數值屬性。

每個容器的集合和計數屬性根據包含在容器中的物件型態來命名。下表列出了容器控制項及其相對的集合和計數屬性。

--------------------------------------------------
容器類別    集合屬性     計數屬性
-------------- ---------------- ------------------
應用程式    Objects Forms  Count FormCount
表單集     Forms      FormCount
表單      Objects Controls Count ControlCount
分頁框     Pages      PageCount
頁面      Controls     ControlCount
多筆編輯控制項 Columns     ColumnCount
指令按鈕組   Buttons     ButtonCount
選項按鈕組   Buttons     ButtonCount
直欄      Controls     ControlCount
工具列     Controls     ControlCount
容器物件    Controls     ControlCount
控制項     Controls     ControlCount
--------------------------------------------------


這些屬性以程式撰寫模式的迴圈方法處理所包含的所有或指定的物件。例如,以下幾行程式碼設定在多筆編輯控制項中直欄的 BackColor 屬性,以製作紅色與綠色交替出現功能:

o = THISFORM.grd1
FOR i = 1 to o.ColumnCount
  IF i % 2 = 0 && 偶數直欄
   o.Columns(i).BackColor = RGB(0,255,0) && 綠色
  ELSE
   o.Columns(i).BackColor = RGB(255,0,0) && 紅色
  ENDIF
ENDFOR



相關資訊

如何:新增 Visual FoxPro 容器控制項

如何:在表單中加入 Visual FoxPro 控制項

在表單中新增物件




----------------------------------------------------------------------------------------------
原文:


Understanding Container and Control Objects


You can add the following types of objects to a form:

•Controls
•Containers
•User-defined classes
•Sharing Information and Adding OLE

Objects in Visual FoxPro belong in one of two categories, depending on the nature of the class they are based on:

•Containers can hold other containers or controls. They can act as the parent object for other objects. For example, a form, as a container, is the parent object of a check box on that form.
•Controls can be placed in containers, but cannot be the parent for other objects. For example, a check box cannot contain any other object.

The Form Designer allows you to design both containers and controls.

----------------------------------------------------------------------------------------------------------
Container      Can contain
-------------------- -------------------------------------------------------------------------------------
Column        Headers, and any objects except form sets, forms, toolbars, timers, and other columns
Command button group Command buttons
Form set       Forms, toolbars
Form         Page frames, grids, any controls
Grid         Columns
Option button group Option buttons
Page frame      Pages
Page         Grids, any controls
----------------------------------------------------------------------------------------------------------



Collection and Count Properties

All container objects in Visual FoxPro have a count property and a collection property associated with them. The collection property is an array referencing each contained object. The count property is a numeric property indicating the number of contained objects.

The collection and count properties for each container are named according to the type of object that can be contained in the container. The following table lists the containers and the corresponding collection and count properties.

---------------------------------------------------
Container  Collection Property Count Property
------------ ------------------- ------------------
Application Objects Forms    Count FormCount
FormSet   Forms        FormCount
Form     Objects Controls  Count ControlCount
PageFrame  Pages        PageCount
Page     Controls      ControlCount
Grid     Columns       ColumnCount
CommandGroup Buttons       ButtonCount
OptionGroup Buttons       ButtonCount
Column    Controls      ControlCount
ToolBar   Controls      ControlCount
Container  Controls      ControlCount
Control   Controls      ControlCount
---------------------------------------------------

These properties allow you to use a loop to programmatically manipulate all or specific contained objects. For example, the following lines of code set the BackColor property of columns in a grid to alternating green and red:

o = THISFORM.grd1
FOR i = 1 to o.ColumnCount
  IF i % 2 = 0 && Even-numbered column
   o.Columns(i).BackColor = RGB(0,255,0) && Green
  ELSE
   o.Columns(i).BackColor = RGB(255,0,0) && Red
  ENDIF
ENDFOR



See Also

How to: Add Visual FoxPro Containers

How to: Add Visual FoxPro Controls to a Form

Adding Objects to Forms

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 154 樓

發表發表於: 星期日 十二月 05, 2004 11:54 pm    文章主題: 引言回覆

如何:新增 Visual FoxPro 容器控制項


除表單集和表單外,Visual FoxPro 還提供四個基本容器:

•指令按鈕組控制項
•多筆編輯控制項
•選項按鈕組控制項
•分頁框控制項



若要在表單中新增容器控制項

•從 [表單控制項] 工具列上選定所需的容器控制項的按鈕 (按鈕組、多筆編輯控制項、選項按鈕組或分頁框),並在表單中拖曳,調整到想要的大小。

在 [表單設計工具] 的表單中新增指令按鈕組或選項按鈕組時,按鈕組預設包含兩個按鈕。在表單中新增分頁框時,分頁框預設包含兩個頁面。將 ButtonCount 屬性或 PageCount 屬性設定為需要的數目,可以包含更多的按鈕或頁面。

在表單中加入多筆編輯控制項時,ColumnCount 屬性的預設值為 -1,表示處於自動填入狀態。這樣,在執行時期多筆編輯控制項將顯示與 RowSource 資料表格中的欄位同樣數目的直欄。如果不想處於自動填入狀態,可以設定多筆編輯控制項的 ColumnCount 屬性以指定直欄的數目。

有關這些容器控制項的詳細內容,請參閱「深入瞭解容器控制項和控制項」和「使用控制項」。



相關資訊

在表單中新增物件

如何:在表單中加入 Visual FoxPro 控制項

建立表單

如何:在表單中新增使用者自訂物件

如何:用表單集擴充表單

如何:使用 [元件陳列庫] 在表單中加入控制項

如何:在一個用精靈產生的表單中加入控制項

如何:選取、移動以及調整表單控制項的大小

對齊表單中的控制項

如何:設定控制項的 Tab 鍵遞移次序




----------------------------------------------------------------------------------------------
原文:


How to: Add Visual FoxPro Containers


In addition to form sets and forms, Visual FoxPro provides four base container classes:

•CommandGroup Control
•Grid Control
•OptionGroup Control
•PageFrame Control



To add container objects to a form

•In the Form Controls toolbar, select the desired container object (button group, grid, option button group, or page frame) button and drag it to size in the form.

When you add a command button group or an option button group to a form in the Form Designer, the group contains two buttons by default. When you add a page frame to a form, the page frame contains two pages by default. You can add more buttons or pages by setting the ButtonCount Property or the PageCount Property to the number you want.

When you add a grid to a form, the ColumnCount property is set to – 1 by default, which indicates AutoFill. At run time, the grid will display as many columns as there are fields in the RowSource table. If you don't want AutoFill, you can specify the number of columns by setting the grid's ColumnCount property.

For more information about these container objects, see Understanding Container and Control Objects and Using Controls.



See Also

Adding Objects to Forms

How to: Add Visual FoxPro Controls to a Form

Creating Forms

How to: Add User-Defined Objects to a Form

How to: Extend Forms with Form Sets

How to: Add Controls to a Form with the Component Gallery

How to: Add Controls to a Wizard-Generated Form

How to: Select, Move, and Resize Form Controls

Aligning Controls in Forms

How to: Set Tab Order for Controls

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 155 樓

發表發表於: 星期二 十二月 07, 2004 1:48 am    文章主題: 引言回覆

如何:在表單中加入 Visual FoxPro 控制項


您可以在表單中新增任何一種標準的 Visual FoxPro 控制項。例如,您可以在表單上為欄位加入標籤,以及加入諸如按鈕、文書編輯方塊、列示方塊,或者加入圖片、線條和幾何圖形來改善表單的外觀。



如何在表單中加入控制項

1.在 [表單設計工具] 中開啟表單。

2.在 [表單控制項] 工具列上,按一下您要加入的控制項。

3.在 [表單設計工具] 中,在表單上於欲放置控制項 (依其預設大小) 的地方按一下。

新的控制項就出現在您設定的位置上,其後您可以在表單中把它移動到最終位置,也可以根據需要調整它的大小。

也可以拖曳游標來依您想要的尺寸繪製控制項。相關詳細資訊請參考「[表單設計工具]」。

在 [檢視] 功能表上按一下 [屬性],開啟 [屬性] 視窗,便可以設定控制項的屬性。[屬性] 視窗顯示了加入到表單中的控制項所具有的全部屬性。相關詳細資訊請參考「[屬性] 視窗 (Visual FoxPro)」。

您可以加入同種型態的多個控制項,而不需每一次選取您要加入的控制項。


若要在表單中加入多個控制項

1.在 [表單設計工具] 中開啟表單。

2.在 [表單控制項] 工具列上,按一下您要加入的控制項。

3.在 [表單控制項] 工具列上,按一下 [控制項鎖定]。

提示:
也可以按兩下您要加入的控制項。


也可以加入多個同型態的控制項而無需在 [表單控制項] 工具列上多次按控制項。



使用 [輔助設計工具] 加入控制項

您不但可以使用精靈用來快速建立表單,而且可以使用 [輔助設計工具] 在表單中明確加入控制項。[輔助設計工具] 會使用您在控制項上回答一系列問題來設定合適的屬性。


如何使用 [輔助設計工具] 加入控制項

1.在 [表單設計工具] 中開啟表單。

2.在 [表單控制項] 工具列上,按一下 [輔助設計工具鎖定]。

3.在表單中加入您要的控制項。

如果可用,會開啟控制項的輔助設計工具。

4.按照 [輔助設計工具] 內的標籤中的提示進行作業。

注意:
若要在 [屬性] 視窗中設定控制項的屬性,請關閉 [輔助設計工具鎖定]。


有關選取控制項的詳細內容,請參閱「使用控制項」。有關有效的影像控制項來源的詳細內容,請參閱「在 Visual FoxPro 中所支援的圖形」。



在表單中新增資料連結控制項

可以使控制項與資料表格、資料集、資料表格的欄位、或資料集的欄位中的資料相聯繫。


如何使控制項與資料表格、資料集、資料表格的欄位、或資料集的欄位中的資料相聯繫

•控制項的 ControlSource 屬性設定了欄位或對多筆編輯控制項的 RecordSource 屬性設定了資料表格或資料集。

相關詳細資訊請參考「ControlSource 屬性」或「RecordSource Property」。

也可以將欄位或資料表格從下列位置拖到表單中,建立資料連結控制項:

•[專案管理員] 視窗
•資料庫設計工具 (Visual FoxPro)
•[資料環境] 設計工具

[資料表格設計工具] 中 [欄位] 標籤的 [將欄位型態對應至類別] 的設定,或 [選項] 對話方塊的 [欄位對應] 標籤的設定,會決定所建立的控制項類型。

提示:
透過把與表單相關的資料表格或資料集放進表單的資料環境中,可以容易地把新控制項與資料表格或資料集中的欄位關聯在一起。[屬性] 視窗中的 ControlSource 屬性顯示 [資料環境] 設計工具中可用的欄位清單,您可以從中選取與控制項相關聯的欄位。



相關資訊

建立表單

在表單中新增物件

如何:使用 [元件陳列庫] 在表單中加入控制項

如何:在一個用精靈產生的表單中加入控制項

如何:在表單中新增使用者自訂物件

如何:選取、移動以及調整表單控制項的大小

對齊表單中的控制項

如何:設定控制項的 Tab 鍵遞移次序




----------------------------------------------------------------------------------------------
原文:


How to: Add Visual FoxPro Controls to a Form


You can add any of the standard Visual FoxPro controls to your form. For example, you can add labels for fields on the form, add controls such as buttons, edit boxes, or list boxes, or add pictures or lines and shapes to enhance the appearance of your form.



To add a control to a form

1.Open the form in the Form Designer.

2.On the Form Controls toolbar, click the control you want to add.

3.In the Form Designer, click the form at the location you want to place the control at its default size.

The new control appears where you placed it. You can then move it to its final location on the form, and resize it as needed.

You can also click and drag the cursor to draw the control with the dimensions that you want. For more information, see Form Designer.

You can now set properties for the control by clicking Properties on the View menu to open the Properties window. The Properties window displays all the properties for the controls you add to a form. For more information, see Properties Window (Visual FoxPro).

You can add multiple controls of the same type without choosing the control each time you want to add a control.


To add multiple controls to a form

1.Open the form in the Form Designer.

2.On the Form Controls toolbar, click the control you want to add.

3.On the Form Controls toolbar, click Button Lock.

Tip:
You can also double-click the control you want to add.


You can now add multiple controls of the same type without clicking the control on the Form Controls toolbar multiple times..



Adding Controls with a Builder

Just as you can use wizards can be used to create forms quickly, you can use a builder to add certain controls to a form. The builder sets the appropriate properties on the control using your answers to a series of questions.


To add a control with a builder

1.Open the form in the Form Designer.

2.On theForm Controls toolbar, click Builder Lock.

3.Add the control you want to the form.

If available, a builder opens for the control.

4.Follow the instructions on the builder tabs.

Note:
To set control properties in the Properties window, turn off the Builder Lock.


For more information choosing controls, see Using Controls. For details on valid image control sources, see Graphics Support in Visual FoxPro.



Adding Data-Bound Controls to a Form

You can bind controls to data in a table, view, table field, or view field.


To bind a control to data in a table, view, or table or view field

•Set the ControlSource property for a control to a field or the RecordSource property of a grid to a table or view.

For more information, see ControlSource Property or RecordSource Property.

You can also create data-bound controls by dragging fields or tables to the form from the following locations:

•Project Manager Window
•Database Designer (Visual FoxPro)
•Data Environment Designer

The type of the control created by dragging a field or table depends on the Field Mappings settings in the Properties tab of the Table Designer or the Field Mapping tab of the Options dialog box.

Tip:
You can make it easier to bind new controls to fields in tables or views by placing the tables or views associated with your form in the form's data environment. The ControlSource property in the Properties window displays a list of the fields available in the Data Environment designer so you can select the one you want to bind to a control.



See Also

Creating Forms

Adding Objects to Forms

How to: Add Controls to a Form with the Component Gallery

How to: Add Controls to a Wizard-Generated Form

How to: Add User-Defined Objects to a Form

How to: Select, Move, and Resize Form Controls

Aligning Controls in Forms

How to: Set Tab Order for Controls

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 156 樓

發表發表於: 星期二 十二月 07, 2004 11:58 pm    文章主題: 引言回覆

如何:使用 [元件陳列庫] 在表單中加入控制項


可以使用 [元件陳列庫] 將自訂的控制項和物件快速地加入至表單中。[元件陳列庫] 中資料夾包含了幾十個自訂的控制項和物件,使用這些控制項和物件可以大大減少建立指定的表單所需的程式碼數量。



如何開啟 [元件陳列庫]

•從[工具] 功能表選取 [元件陳列庫]。

當 [元件陳列庫] 開啟時,可以從 [元件陳列庫] 中將自訂的控制項和物件拖至表單中。



相關資訊

使用 [元件陳列庫]

如何:新增 Visual FoxPro 容器控制項

如何:在表單中新增使用者自訂物件

建立表單

在表單中新增物件

如何:在表單中加入屬性和方法程序

[資料表格設計工具] (Visual FoxPro)

[選項] 對話方塊中的 [欄位對應] 標籤

如何:在表單中加入 Visual FoxPro 控制項

如何:在一個用精靈產生的表單中加入控制項

如何:選取、移動以及調整表單控制項的大小

對齊表單中的控制項

如何:設定控制項的 Tab 鍵遞移次序




----------------------------------------------------------------------------------------------
原文:


How to: Add Controls to a Form with the Component Gallery


You can use the Component Gallery to quickly add custom controls and objects to a form. The Component Gallery contains dozens of custom controls and objects that greatly reduce the amount of coding required to create specialized forms.



To open the Component Gallery

•From the Tools menu, choose Component Gallery.

When the Component Gallery is open, you can drag custom controls and objects from the Component Gallery and drop them on a form.



See Also

Using the Component Gallery

How to: Add Visual FoxPro Containers

How to: Add User-Defined Objects to a Form

Creating Forms

Adding Objects to Forms

How to: Add Properties and Methods to a Form

Table Designer (Visual FoxPro)

Field Mapping Tab, Options Dialog Box

How to: Add Visual FoxPro Controls to a Form

How to: Add Controls to a Wizard-Generated Form

How to: Select, Move, and Resize Form Controls

Aligning Controls in Forms

How to: Set Tab Order for Controls

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 157 樓

發表發表於: 星期三 十二月 08, 2004 11:35 pm    文章主題: 引言回覆

如何:在一個用精靈產生的表單中加入控制項


如果您使用表單精靈建立了一個表單,然後又想在表單中加入控制項,可以使用精靈控制項函數庫 — Wizstyle.vcx 中的控制項以符合既存的控制項的樣式。

開啟精靈控制項函數庫後,即可使用 [表單控制項] 工具列中的精靈樣式控制項 (例如 chiselfield、embossedmemo 等)。要找出想要使用的控制項,可選取一個既存的控制項並指明它的類別和類別定義函數庫。例如,一個標準的精靈欄位可以在 Wizstyle.vcx 的 Standardfield 類別中找到。

提示:
使用 [表單控制項] 工具列上的工具秘訣,可幫助識別類別名稱。



如何在用精靈產生的表單中使用相符合的控制項

1.在 [表單設計工具] 中開啟表單。

2.從 [表單控制項] 工具列中選取 [檢視類別] 按鈕,然後選取 [新增]。

3.在 [開啟] 對話方塊中,在 Wizards 子目錄中選取 Wizstyle.vcx 並選取 [開啟]。

4.在 [表單控制項] 工具列中,選取對應於表單中既存的控制項的圖示,並把它拖到表單中。

注意:
如果把一個表單移到一個新的目錄或另一個系統中,應該把與表單相關的控制項函數庫同表單一起移走。



相關資訊

在表單中新增物件

如何:使用 [元件陳列庫] 在表單中加入控制項

如何:建立新的表單

如何:使用本地和遠端資料建立表單

如何:在表單中加入 Visual FoxPro 控制項

建立表單

如何:在表單中新增使用者自訂物件

如何:選取、移動以及調整表單控制項的大小

對齊表單中的控制項

如何:設定控制項的 Tab 鍵遞移次序




----------------------------------------------------------------------------------------------
原文:


How to: Add Controls to a Wizard-Generated Form


If you create a form with one of the form wizards and then want to add controls to it, you can match the style of the existing controls by using the controls in the wizard controls library, Wizstyle.vcx.

When you open the wizards control library, wizard-style controls (such as chiselfield, embossedmemo, and so on) are available in the Form Controls toolbar. To find out which control to use, select an existing control and note its class and class library. For example, a standard wizard field would be in the Standardfield class, found in Wizstyle.vcx.

Tip:
Use ToolTips on the Form Controls toolbar to help you identify class names.



To match controls in a wizard-generated form
1.In the Form Designer, open the form.

2.From the Form Controls toolbar, choose the View Classes button and choose Add.

3.In the Open dialog box, locate Wizstyle.vcx in the Wizards subdirectory and choose OK.

4.In the Form Controls toolbar, select the control that corresponds to an existing control in the form and drag in the form to add it.

Note:
If you move a form to a new directory or another system, you should move the control library associated with the form along with it.



See Also

Adding Objects to Forms

How to: Add Controls to a Form with the Component Gallery

How to: Create a New Form

How to: Create Forms with Local and Remote Data

How to: Add Visual FoxPro Controls to a Form

Creating Forms

How to: Add User-Defined Objects to a Form

How to: Select, Move, and Resize Form Controls

Aligning Controls in Forms

How to: Set Tab Order for Controls

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 158 樓

發表發表於: 星期四 十二月 09, 2004 10:52 pm    文章主題: 引言回覆

如何:選取、移動以及調整表單控制項的大小


建立一個表單之後,可能需要調整表單上控制項的位置和大小。例如,要移動一個附註欄位,或讓一個文字輸入方塊更長一些。



如何選取一個控制項

•將指標指向控制項上的任意位置並按一下。



如何選取相鄰的控制項

1.在 [表單控制項] 工具列中選取 [選定物件] 按鈕。

2.拖曳指標,在想選取的控制項周圍畫一個框。



如何移動控制項

1.按一下選取的控制項。

2.在表單視窗中將該控制項拖曳到新的位置。

-或者-

選取控制項然後用方向鍵重新定位。



如何調整控制項的大小

1.選取控制項。

2.拖曳一個控制項大小,來增加該控制項的長度、寬度或整體尺寸。



相關資訊

在表單中新增物件

如何:使用 [元件陳列庫] 在表單中加入控制項

如何:拖曳欄位或資料表格來建立控制項

如何:建立新的表單

如何:使用本地和遠端資料建立表單

如何:在表單中加入 Visual FoxPro 控制項

建立表單

如何:在一個用精靈產生的表單中加入控制項

如何:在表單中新增使用者自訂物件

對齊表單中的控制項

如何:設定控制項的 Tab 鍵遞移次序




----------------------------------------------------------------------------------------------
原文:


How to: Select, Move, and Resize Form Controls


After creating a form, you may need to adjust the placement or size of the controls on the form. For example, you might want to move a memo field, or make a text box longer.



To select a control

•Using the pointer, click anywhere on the control.



To select adjacent controls

1.Choose the select arrow in the Form Controls toolbar.

2.By dragging the pointer, draw a box around the controls you want to select.



To move a control

1.Select the control by clicking it.

2.Drag the control to the new position in the form window.

-or-

Select the control and use the arrow keys to reposition it.



To resize a control

1.Select the control.

2.Drag one of the sizing handles to increase the length, width, or overall size of the control.



See Also

Adding Objects to Forms

How to: Add Controls to a Form with the Component Gallery

How to: Create Controls by Dragging and Dropping Fields or Tables

How to: Create a New Form

How to: Create Forms with Local and Remote Data

How to: Add Visual FoxPro Controls to a Form

Creating Forms

How to: Add Controls to a Wizard-Generated Form

How to: Add User-Defined Objects to a Form

Aligning Controls in Forms

How to: Set Tab Order for Controls

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 159 樓

發表發表於: 星期五 十二月 10, 2004 11:36 pm    文章主題: 引言回覆

如何:複製和移除表單控制項


當設計或修改一個表單時,可能需要複製一個已在表單上的控制項。您可以複製一個既存的控制項並把它貼到您的表單上。



如何複製控制項

1.用指標選取一個控制項。

2.從 [編輯] 功能表中選取 [複製]。

3.從 [編輯] 功能表中選取 [貼上]。

4.使用指標把該控制項重新設定到所需的位置上。



如果建立了一個控制項,後來又不需要它了,或不想使用某個用精靈建立的控制項,您可以移除這個控制項。


如何移除控制項

•選取控制項,並從 [編輯] 功能表上選取 [剪下]。



相關資訊

在表單中新增物件

如何:使用 [元件陳列庫] 在表單中加入控制項

如何:拖曳欄位或資料表格來建立控制項

如何:建立新的表單

如何:使用本地和遠端資料建立表單

如何:在表單中加入 Visual FoxPro 控制項

建立表單

如何:在一個用精靈產生的表單中加入控制項

如何:在表單中新增使用者自訂物件

如何:選取、移動以及調整表單控制項的大小

對齊表單中的控制項

如何:設定控制項的 Tab 鍵遞移次序




----------------------------------------------------------------------------------------------
原文:


How to: Copy and Delete Form Controls


When designing or modifying a form, you may want to make a copy of a control that is already on the form. You can copy an existing control and paste the copy onto your form.



To copy a control

1.Using the pointer, select a control.

2.From the Edit menu, choose Copy.

3.From the Edit menu, choose Paste.

4.Use the pointer to reposition the control as needed.



If you create a control and then decide you don't need it, or don't want a control created by a wizard, you can remove the control.


To delete a control

•Select the control and choose Cut from the Edit menu.



See Also

Adding Objects to Forms

How to: Add Controls to a Form with the Component Gallery

How to: Create Controls by Dragging and Dropping Fields or Tables

How to: Create a New Form

How to: Create Forms with Local and Remote Data

How to: Add Visual FoxPro Controls to a Form

Creating Forms

How to: Add Controls to a Wizard-Generated Form

How to: Add User-Defined Objects to a Form

How to: Select, Move, and Resize Form Controls

Aligning Controls in Forms

How to: Set Tab Order for Controls

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 160 樓

發表發表於: 星期六 十二月 11, 2004 10:07 pm    文章主題: 引言回覆

對齊表單中的控制項


利用 [版面配置] 工具列上的按鈕,很容易精確配置表單上的控制項。例如,您可能想使一組控制項水平對齊或垂直對齊,或者使一組相關控制項具有相同的寬度或高度。要對齊控制項,先選取一組控制項,然後在 [版面配置] 工具列上選取一個配置按鈕。



調整控制項的位置

如果您想在螢幕上精確地放置控制項,可以使用 [檢視] 功能表中的 [顯示位置] 命令。如果選取該命令,在 [表單設計工具] 視窗底部的狀態列上就會顯示選取控制項的座標和度量單位。



控制項格線顯示

格線顯示可以輔助您在表單上對齊控制項。您可以用 [格式] 功能表中的 [設定座標方格的刻度] 調整座標方格線的尺寸,用 [選項] 對話方塊 [表單] 標籤中的 [座標方格線] 選項開啟或關閉格線的顯示。

您也可以用 [格式] 功能表上的 [對齊座標方格線] 命令,調整控制項相對於座標方格線的大小或位置。當選取 [格式] 功能表中的 [對齊座標方格線] 時,放置在表單上的控制項將自動與座標方格線對齊。您可以用以下方法取消格線的作用:

•清除 [格式] 功能表中 [對齊座標方格線] 旁邊的選取記號。在預設情況下,該命令被選取。
•用方向鍵來對齊控制項。
•在按一下控制項之前按住 CTRL 鍵,並在將該物件拖到另一個位置的過程中按住 CTRL 鍵不放。
•在 [版面配置] 工具列或 [格式] 功能表中選取對齊選項。



相關資訊

對齊表單中的控制項

如何:新增 Visual FoxPro 容器控制項

如何:在表單中新增使用者自訂物件

建立表單

在表單中新增物件

如何:在表單中加入屬性和方法程序

如何:在表單中加入 Visual FoxPro 控制項

如何:在一個用精靈產生的表單中加入控制項

如何:在表單中新增使用者自訂物件

如何:選取、移動以及調整表單控制項的大小

如何:設定控制項的 Tab 鍵遞移次序




----------------------------------------------------------------------------------------------
原文:


Aligning Controls in Forms


The buttons on the Layout toolbar make it easy to accurately line up controls in relation to each other in your forms. For example, you might want to align controls horizontally or vertically or make sure that a related set of controls has the same width or height. To align controls, select a group of controls, and then choose one of the layout buttons on the Layout toolbar.



Adjusting Control Placement

If you need to place controls precisely on the screen, you can use Show Position on the View menu. When checked, Show Position displays the coordinates and dimensions of a selected control in the status bar at the bottom of the Form Designer window.


Controlling the Grid Display

The grid display helps you align controls on your forms. You can adjust the size of the grid with Set Grid Scale on the Format menu. You can turn display of the grid on and off by using the Grid Lines command on the View menu, or setting the Grid Lines option on the Forms tab of the Options dialog box.

You can also adjust the size or position of controls in relation to the grid with Snap to Grid on the Format menu. When Snap to Grid is checked on the Form menu, controls placed on a Form are automatically aligned to the guidelines on the grid. You can override the grid by:

•Clearing Snap to Grid on the Format menu. By default, this option is checked.
•Using the arrow keys to align controls.
•Pressing CTRL before clicking on a control and holding the CTRL key down while dragging the object to another position.
•Choosing alignment options from the Layout toolbar or the Format menu.



See Also

Aligning Controls in Forms

How to: Add Visual FoxPro Containers

How to: Add User-Defined Objects to a Form

Creating Forms

Adding Objects to Forms

How to: Add Properties and Methods to a Form

How to: Add Visual FoxPro Controls to a Form

How to: Add Controls to a Wizard-Generated Form

How to: Add User-Defined Objects to a Form

How to: Select, Move, and Resize Form Controls

How to: Set Tab Order for Controls

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 161 樓

發表發表於: 星期日 十二月 12, 2004 10:10 pm    文章主題: 引言回覆

如何:設定控制項的 Tab 鍵遞移次序


當使用者按住 Tab 鍵在表單上移動時,表單的 Tab 鍵遞移次序決定了選取控制項的順序。

您可以用兩種不同方法設定 Tab 鍵遞移次序:交談方式地按照使用表單時需要的選取控制項的順序按一下控制項;或在一個對話方塊中重排。



如何選取設定 Tab 鍵遞移次序

1.從 [工具] 功能表選取 [選項]。

2.在 [選項] 對話方塊中選取 [表單] 標籤。

3.在 [Tab 鍵遞移次序] 選項下,選取 [交談模式] 或 [按列表]。



以交談模式設定 Tab 鍵遞移次序

在交談模式中,對要做為在 Tab 鍵遞移次序的第一個控制項,可透過用滑鼠按兩下來設定 Tab 鍵遞移次序,然後依您要在表單中選取控制項的順序再依序於其他的控制項各只按一下。以高亮度顯示的 Tab 鍵遞移次序數目表示最後所選定的控制項。


如何以交談方式改變 Tab 鍵遞移次序

1.從 [檢視] 功能表中選取 [遞移順序]。

2.若想使某個控制項成為 Tab 鍵遞移次序中的第一個,按兩下該控制項旁的 Tab 鍵遞移次序框。

3.對其他的每個控制項按一下 Tab 鍵遞移次序框。

4.按一下表單的任何一處來儲存所做的變更,並結束 [Tab 鍵遞移次序] 模式,或者按 ESC 鍵結束 [Tab 鍵遞移次序] 模式,但不儲存所做的變更。



用列表設定 Tab 鍵遞移次序

在列表模式中,可以透過在 [遞移順序] 對話方塊中重新排列控制項的名稱來設定 Tab 鍵遞移次序。可以按列 (在表單中由上向下) 或按行 (在表單中由左向右) 設定 Tab 鍵遞移次序。


如何用列表設定 Tab 鍵遞移次序

1.從 [檢視] 功能表中選取 [遞移順序]。

2.選取 [按列] 或 [按行] 按鈕。

3.在 [遞移順序] 對話方塊中,用指標重排順序。

4.選取 [確定] 按鈕。



相關資訊

在表單中新增物件

[遞移順序] 對話方塊

如何:新增 Visual FoxPro 容器控制項

如何:在表單中新增使用者自訂物件

建立表單

在表單中新增物件

如何:在表單中加入屬性和方法程序

如何:在表單中加入 Visual FoxPro 控制項

如何:在一個用精靈產生的表單中加入控制項


如何:選取、移動以及調整表單控制項的大小




----------------------------------------------------------------------------------------------
原文:


How to: Set Tab Order for Controls


The tab order of a form determines the sequence in which the controls are selected when a user presses the TAB key to move through the form.

You can choose two different methods for setting tab order: interactively, by clicking the controls in the order you want them to be selected when the form is used; or by arranging a list of controls in a dialog box.



To choose a tab-ordering method

1.From the Tools menu, choose Options.

2.In the Options dialog box choose the Forms tab.

3.Under the Tab Ordering option, select Interactive or By List.



Setting Tab Order Interactively

In interactive mode, you set tab order by double-clicking the control you want to be first in the tab order, and then single-clicking on the rest of the controls in the order in which you want them to be selected in the form. The last control selected is indicated with a highlighted tab order number.


To change the tab order interactively

1.From the View menu, choose Tab Order.

2.Double-click the tab order box beside the control you want to be the first control in the tab order.

3.Click the tab order box for each of the other controls.

4.Click anywhere on the form to save your changes and exit Tab Order mode, or press ESC to exit Tab Order mode without saving your changes.



Setting Tab Order by List

In list mode, you set tab order by rearranging the control names in the Tab Order dialog box. You can set order by row (down the form) or by column (across the form).


To set the tab order using a list

1.From the View menu, choose Tab Order.

2.Choose By Row or By Column.

3.In the Tab Order dialog box, use the pointer to rearrange the list.

4.Choose OK.



See Also

Adding Objects to Forms

Tab Order Dialog Box

How to: Add Visual FoxPro Containers

How to: Add User-Defined Objects to a Form

Creating Forms

Adding Objects to Forms

How to: Add Properties and Methods to a Form

How to: Add Visual FoxPro Controls to a Form

How to: Add Controls to a Wizard-Generated Form

How to: Select, Move, and Resize Form Controls

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 162 樓

發表發表於: 星期一 十二月 13, 2004 10:21 pm    文章主題: 引言回覆

如何:在表單中新增使用者自訂物件


Visual FoxPro 最強大的功能之一就是能建立在應用程式不同部份都可以使用和重覆使用的類別。如果建立了類別,您就能將它們新增到表單中。



若要根據使用者自訂類別建立物件

•在 [專案管理員] 視窗中,將類別拖曳到容器控制項中。

當給工具列新增類別時,也可直接從 [表單控制項] 工具列中新增。



在 [控制項] 工具列上新增類別定義函數庫

類別定義函數庫必須在註冊後才能在 [表單控制項] 工具列中顯示出來。


若要註冊類別定義函數庫

1.從 [工具] 功能表選取 [選項]。

2.在 [選項] 對話方塊中選定 [控制項] 標籤。

3.選定 [加入] 按鈕。

4.在 [開啟] 對話方塊中,選定一個類別定義函數庫加到 [已被選定] 清單中,並選定 [開啟] 按鈕。

5.重覆步驟 3 和 4,直到加入所有您要註冊的函數庫。

[已被選定] 清單中列出了類別定義函數庫中的類別,在 [表單設計工具] 中可以和 Visual FoxPro 基本類別一樣方便地使用這些類別。

提示:
如果要在每次執行 Visual FoxPro 時 [表單控制項] 工具列中的類別定義函數庫都有效,可在 [選項] 對話方塊中,選定 [設定為預設值]。


也可以在 [表單設計工具] 中直接註冊類別定義函數庫。


若要在 [表單設計工具] 中註冊一個類別定義函數庫

1.在 [表單控制項] 工具列中選定 [檢視類別] 按鈕。

2.從子功能表中選定 [新增]。

3.在 [開啟] 對話方塊中選定要新增到 [表單控制項] 工具列上的類別定義函數庫,然後選定 [開啟] 按鈕。



從類別定義函數庫中新增物件到表單

如果您從 [選項] 對話方塊的 [控制項] 標籤或從 [檢視類別] 子功能表的 [新增...] 來加入類別定義函數庫,您就能在 [表單設計工具] 中存取它們。


若要從 [控制項] 工具列新增自訂物件

1.在 [表單控制項] 工具列中選定 [檢視類別] 按鈕。

2.從已註冊類別定義函數庫的清單中選定一個類別定義函數庫,它包含了要加到表單中的控制項。

3.工具列與已核取類別定義函數庫中的控制項放在一起。

按一下所需要的控制項,並在表單中拖放到合適大小。

注意:
如果想從 [檢視類別] 工具列中移除一個類別定義函數庫,可以在 [選項] 對話方塊的 [控制項] 標籤中,選定 [已被選定] 清單中顯示的類別定義函數庫,然後選定 [移除] 按鈕。

當向不是根據 Visual FoxPro 基本類別的表單新增物件時,類別定義函數庫的相對路徑 (.vcx 檔案) 儲存在表單的 .scx 檔案中。如果要將表單或類別定義函數庫移到另一個位置,在執行表單時 Visual FoxPro 顯示一個對話方塊,可以手動搜尋類別定義函數庫。


若要確定表單中的控制項數目

•使用 ControlCount 屬性。

表單的 Controls 屬性允許參考表單上的任何一個控制項。下面的程式用於列印出目前作用表單上所有控制項的 Name 屬性。

ACTIVATE SCREEN && 將輸出列印到 Visual FoxPro 桌面視窗
FOR nCnt = 1 TO Application.ActiveForm.ControlCount
? Application.ActiveForm.Controls[nCnt].Name
ENDFOR



相關資訊

如何:在表單中新增使用者自訂物件

如何:在表單中加入屬性和方法程序

建立表單

在表單中新增物件

[專案管理員] 視窗

如何:使用 [元件陳列庫] 在表單中加入控制項

如何:在一個用精靈產生的表單中加入控制項

如何:選取、移動以及調整表單控制項的大小

對齊表單中的控制項

如何:設定控制項的 Tab 鍵遞移次序




----------------------------------------------------------------------------------------------
原文:


How to: Add User-Defined Objects to a Form


One of the most powerful features of Visual FoxPro is the ability to create classes that can easily be used and reused in various pieces of your applications. Once you've created classes, you can add them to your forms.



To add an object based on a custom class

•In the Project Manager Window, drag the class onto the container.

You can also add your classes directly from the Form Controls toolbar when you add them to your toolbar.



Adding Class Libraries to the Controls Toolbar

You need to register your class libraries before they can be displayed in the Form Controls toolbar.


To register a class library

1.From the Tools menu, choose Options.

2.In the Options dialog box, choose the Controls tab.

3.Choose Add.

4.In the Open dialog box, choose a class library to add to the Selected list and choose Open.

5.Repeat steps 3 and 4 until you've added all the libraries you want to register.

Classes in the class libraries in the Selected list can be used in the Form Designer as easily as Visual FoxPro base classes can be used.

Tip:
If you want the class libraries to be available from the Form Controls toolbar every time you run Visual FoxPro, choose Set as Default in the Options dialog box.

You can also register libraries directly in the Form Designer.


To register a class library in the Form Designer

1.In the Form Controls toolbar, choose the View Classes button.

2.From the submenu, choose Add.

3.In the Open dialog box, choose a class library to add to the Form Controls toolbar and choose Open.



Adding Objects to a Form from a Class Library

Once you've added class libraries in the Classes tab of the Options dialog box or from the View Classes submenu, you can access them in the Form Designer.


To add a custom object from the Controls toolbar

1.In the Form Controls toolbar, choose the View Classes button.

2.From the list of registered class libraries, select the library that contains the control you want to add to the form.

3.The toolbar is populated with the controls in the library you selected.

Click the control you want and drag it to size in the form.

Note:
You can remove a visual class library from the View Classes toolbar menu by selecting the library in the Selected list in the Controls tab of the Options dialog box, and choosing Remove.

When you add objects to a form based on anything other than the Visual FoxPro base classes, a relative path to the class library (.vcx file) is stored in the form's .scx file. If you move either the form or the class library to a different location, Visual FoxPro displays a dialog box when you try to run the form so that you can manually locate the class library.


To determine how many controls are on a form

•Use the ControlCount Property.

The Controls property of the form allows you to reference each control on the form. The following program prints the Name property of all the controls on the currently active form.

ACTIVATE SCREEN && to print to the main Visual FoxPro window
FOR nCnt = 1 TO Application.ActiveForm.ControlCount
? Application.ActiveForm.Controls[nCnt].Name
ENDFOR



See Also

How to: Add User-Defined Objects to a Form

How to: Add Properties and Methods to a Form

Creating Forms

Adding Objects to Forms

Project Manager Window

How to: Add Controls to a Form with the Component Gallery

How to: Add Controls to a Wizard-Generated Form

How to: Select, Move, and Resize Form Controls

Aligning Controls in Forms

How to: Set Tab Order for Controls

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 163 樓

發表發表於: 星期三 十二月 15, 2004 12:42 am    文章主題: 引言回覆

處理物件


在設計時期可以處理和使用表單上的物件。

下列清單描述在表單上透過物件可以執行的任務:

•在 [表單設計工具] 中透過伸展、縮小或拖曳來設定物件的大小和位置。
•選定 [格式] 功能表中的選項,或者選定 [版面配置] 工具列上的對齊工具可以對齊控制項。有關 [版面配置] 工具列的詳細內容,請參閱「對齊表單中的控制項」。
•使用 [調色板] 工具列來設定顏色。有關 [調色板] 工具列的詳細內容,請參閱「自訂表單」。
•使用 [屬性] 視窗來檢視物件屬性的設定,顯示物件、事件和方法程序所繼承的程式碼,設定屬性的值,以及限制僅能檢視已修改的性。

[屬性] 視窗是表單上控制所有物件的主要地方。[屬性] 視窗顯示屬性、事件和方法程序,以及選取的表單、資料環境、暫存資料表格、關聯或控制項的設定。有關 [屬性] 視窗的詳細內容,請參閱「[屬性] 視窗 (Visual FoxPro)」。



在本章節中


如何:檢視物件的屬性

討論該如何在 [屬性] 視窗中檢視物件的屬性、方法程序和事件。


如何:設定物件的屬性

描述如何在設計時期或以程式撰寫模式來設定或編輯物件的屬性值。


如何:顯示物件、事件和方法程序所繼承的程式碼

說明如何顯示從父類別的物件、事件和方法程序所繼承的程式碼。


如何:顯示已修改設定的屬性

說明如何在 [屬性] 視窗中只顯示已修改設定的屬性。


處理物件範例

表單集中包含兩個表單的範例。此範例展示了位於表單集中設定屬性,並從許多物件中呼叫事件。



相關章節


表單的設計

提供「說明如何使用 Visual FoxPro 設計工具建立表單」的主題連結。


在表單中新增物件

提供「說明以不同方法在表單中加入物件」的主題連結。


處理表單

提供「說明如何處理表單,例如如何執行表單或如何停駐表單」的主題連結。




----------------------------------------------------------------------------------------------
原文:


Manipulating Objects


You can manipulate and work with objects on a form at design time.

The following list describes some of the tasks you can perform with objects on the form:

•Set the size and position of objects in the Form Designer by expanding, shrinking, or dragging them.
•Align controls by choosing options on the Format menu or using the alignment tools on the Layout toolbar. For more information about the Layout toolbar, see Aligning Controls in Forms.
•Set colors using the Palette toolbar. For more information about using the Palette toolbar, see Customizing Forms.
•View object property settings, display inherited code for objects, events, and methods, set values for properties, and restrict your view to only modified properties using the Properties window.

The Properties window is the primary location for controlling all objects on the form. The Properties window displays the properties, events, and methods and their settings for a selected form, data environment, cursor, relation, or control. For more information about the Properties window, see Properties Window (Visual FoxPro).



In This Section


How to: View Properties for Objects

Discusses how to view an object's properties, methods, and events in the Properties window.


How to: Set Properties for Objects

Describes how to set or edit the value of an object's property at design time or programmatically.


How to: Display Inherited Code for Objects, Events, and Methods

Explains how to display code inherited from parent classes for objects, events, and methods.


How to: Show Properties with Modified Settings

Explains how to display only those properties with modified settings in the Properties window.


Example of Manipulating Objects

Contains an example with two forms in a formSet. The example illustrates how to set properties and call event code from a number of objects inside a formset.



Related Sections


Designing Forms

Provides links to topics that explain how to use the Visual FoxPro designers to create forms.


Adding Objects to Forms

Provides links to topics that explain the various ways to add objects to forms.


Working with Forms

Provides links to topics that explain how to work with forms, such as how to run a form or how to dock forms.

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 164 樓

發表發表於: 星期四 十二月 16, 2004 12:22 am    文章主題: 引言回覆

如何:檢視物件的屬性


對於某些物件可以藉由在 [屬性] 視窗中顯示它們來檢視其屬性、方法程序和事件,例如,表單或表單上的物件。相關詳細資訊請參考「[屬性] 視窗 (Visual FoxPro)」。



如何檢視物件的屬性

1.選取要檢視屬性的物件。

2.在 [視窗] 功能表上,按一下 [屬性視窗]。

如果快顯功能表可用時,也可以透過對物件按滑鼠右鍵然後選取 [屬性] 來檢視物件的屬性。當 [屬性] 視窗開啟後,可以透過在 [屬性] 視窗的 [物件] 清單中選取物件來檢視屬性。[屬性] 視窗更新顯示對所選定物件的屬性、事件和方法程序。

提示:
若要檢視多個物件的共同屬性時,請在表單上選取若干物件時按住 SHIFT 鍵。[屬性] 清單會顯示你所選定物件的共同屬性。



檢視 [屬性] 視窗中截斷的值

如果某些屬性、事件和方法程序的值超出 [屬性] 視窗的右邊時,這些值在 [屬性] 清單中會出現截斷狀況。不過,您仍可以檢視這些被截斷的值。



若要檢視 [屬性] 清單中被截斷的值

•展開 [屬性] 視窗。

-或者-

•將滑鼠指標移到 [屬性] 清單中的屬性、事件或方法程序上,可顯示其值。

如果方法程序和事件所繼承的視覺化類別定義函數庫存在時會顯示文字提示,以及顯示唯讀屬性的設定值之文字提示。



檢視唯讀屬性的值

您可以不需展開 [屬性] 視窗來檢視 [屬性] 視窗中被截斷的唯讀屬性的值。


若要檢視唯讀屬性的值

1.在 [屬性] 視窗中,對您要檢視的屬性上按滑鼠右鍵。

2.在快顯功能表中選取 [屬性放大]。

相關詳細資訊請參考「[縮放] 對話方塊」。



相關資訊

處理物件

如何:在表單中加入屬性和方法程序

控制表單行為

建立表單

如何:編輯事件和方法程序的程式碼

[表單設計工具]




----------------------------------------------------------------------------------------------
原文:


How to: View Properties for Objects


You can view properties, methods, and events for certain objects, for example, for a form or an object on a form, by displaying them in the Properties window. For more information, see Properties Window (Visual FoxPro).



To view properties for an object

1.Select the object that you want to view properties for.

2.On the Window menu, click Properties Window.

You can also view properties for an object by right-clicking the object and choosing Properties, when available, from the shortcut menu. When the Properties window is open, you can view properties by selecting objects in the object list of the Properties window. The Properties window refreshes to display the properties, events, and methods for the selected object.

Tip:
To view properties that multiple objects have in common, press and hold SHIFT while you select several objects on the form. The properties list shows common properties for the objects you select.



Viewing Truncated Values in the Properties Window

Sometimes values for properties, events, and methods can appear truncated in the properties list if the values extend beyond the right edge of the Properties window. However, you can still view these truncated values.


To view a truncated value in the properties list

•Expand the Properties window.

-OR-

•Moving the mouse over the property, event, or method in the properties list to display the value tip.

Value tips show the visual class libraries, if they exist, from which methods and events are inherited and settings for read-only properties.



Viewing Values for Read-Only Properties

You can view the value for a read-only property that appears truncated in the Properties window without expanding the Properties window.


To view the value for a read-only property

1.In the Properties window, right-click the property you want to view.

2.On the shortcut menu, select Zoom.

For more information, see Zoom <property> Dialog Box.



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

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 165 樓

發表發表於: 星期四 十二月 16, 2004 11:02 pm    文章主題: 引言回覆

如何:設定物件的屬性


您可以在設計時期或以程式撰寫模式來設定或變更屬性。

注意:
有些屬性是在設計時期評估,所以這些屬性在運算式中所使用的任何記憶體變數或陣列在設計時期都必須在範圍值內。那些在設計時期為唯讀的屬性,例如物件的 Class 屬性,在 [屬性] 視窗的 [屬性] 清單中是以斜體顯示。



若要設定或編輯屬性的值

1.按一下表單上的一個物件。

2.在 [屬性] 視窗的 [屬性] 清單中選定一個屬性。

3.在 [屬性設定] 方塊中,為選中的屬性鍵入或選定需要的設定。

也可以在 [屬性] 視窗的 [物件] 方塊中選定一個物件。

如果屬性要求輸入字元值,不必用引號將這個值括起來。例如,要將一個表單的標題顯示為 Customer,只需在 [屬性設定] 方塊中鍵入 Customer。不過,若想讓標題顯示為 "Customer",即想讓引號 ("") 也出現在標題上,請在 [屬性設定] 方塊中鍵入 "Customer"。



使用運算式設定屬性

在 [屬性] 視窗中,您可以將屬性設定為運算式或函數。在 [屬性] 視窗中設定一個屬性運算式,以及在設計時期或執行時期起始化物件時,Visual FoxPro 才對這個屬性運算式進行求值。如果建立了物件,除非您或使用者明確地改變它,否則屬性設定都不會改變。

警告:
如果將屬性設定為使用者自訂函數的結果,那麼當設定或修改這個屬性,以及執行表單時,Visual FoxPro 對這個函數進行求值。如果使用者自訂函數出現錯誤,有可能打不開這個表單。


若要用運算式設定屬性

1.在 [屬性] 清單中選取要輸入運算式的屬性。

2.在 [屬性設定] 方塊中鍵入一個等號 (=),並在後面鍵入運算式。

例如,如果您想設定表單的 Caption 屬性,使它在執行表單時能夠指示目前的作用資料表格,可在 [屬性設定] 方塊中鍵入 =ALIAS( )。

也可以透過 [運算式產生器] 對話方塊來指定屬性的運算式。若要開啟 [運算式產生器],請選定要設定的屬性並按一下在 [屬性] 視窗中的 [函數] 按鈕。

也可以在物件的 Init 事件中將屬性設定為使用者自訂函數,如下例所示:

THIS.Caption = myfunction( )

不過,如果使用者自訂函數出現錯誤,就無法執行表單,但可以修改它。



相關資訊

處理物件

如何:在表單中加入屬性和方法程序

控制表單行為

建立表單

如何:編輯事件和方法程序的程式碼

[表單設計工具]




----------------------------------------------------------------------------------------------
原文:


How to: Set Properties for Objects


You can set or change properties at design time or programmatically.

Note:
Some properties are evaluated at design time, so any memory variables or arrays used in expressions for these properties must be in scope at design time. Properties that are read-only at design time, such as the Class property of an object, are displayed in italics in the properties list of the Properties window.



To set or edit the value for a property

1.Click an object on the form.

2.From the properties list in the Properties window, select a property.

3.In the property settings box, type or choose the desired setting for the selected property.

You can also select an object from the object box in the Properties window.

If the property requires a character value, you do not have to include the value in quotation marks. For example, if you want the caption of a form to display as Customer, type Customer in the property settings box. However, if you want the caption to display as "Customer" with quotation marks (""), type "Customer" in the property settings box.



Setting Properties to Expressions

You can set certain properties to the results of expressions or functions in the Properties window. Visual FoxPro evaluates the expression for a property when you enter it in the Properties window and when the object is initialized at design or run time. Once the object is created, the property setting does not change until you or the user explicitly changes it.

Caution:
If you set a property to the result of a user-defined function, Visual FoxPro evaluates the function when you set the property, or when you modify or run the form. If an error exists in the user-defined function, you might not be able to open your form.


To set a property to an expression

1.From the properties list, select the property for which you want to enter an expression.

2.In the property settings box, type an equal sign (=) followed by the expression.

For example, you can indicate the currently active table when the form runs by selecting the Caption property of the form and typing =ALIAS( ) in the property settings box.

You can also specify expressions for properties by using the Expression Builder Dialog Box. To open the Expression Builder, select the desired property and click the Function button in the Properties window.

You can also set the property to the user-defined function in the Init event of the object as in the following example:

THIS.Caption = myfunction( )

However, if an error exists in the user-defined function, you will still be unable to run the form, but you can modify it.



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

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
從之前的文章開始顯示:   
發表新主題   回覆主題    VFP 愛用者社區 首頁 -> VFP 討論區 所有的時間均為 台北時間 (GMT + 8 小時)
前往頁面 上一頁  1, 2, 3 ... 10, 11, 12, 13, 14  下一頁
11頁(共14頁)

 
前往:  
無法 在這個版面發表文章
無法 在這個版面回覆文章
無法 在這個版面編輯文章
無法 在這個版面刪除文章
無法 在這個版面進行投票
無法 在這個版面附加檔案
無法 在這個版面下載檔案


Powered by phpBB © 2001, 2005 phpBB Group
正體中文語系由 phpbb-tw 維護製作