Form.ActiveForm プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Public Shared ReadOnly Property ActiveForm As Form
現在アクティブなフォームを表す Form。アクティブなフォームがない場合は null 参照 (Visual Basic では Nothing)。

このメソッドを使用して、現在アクティブなフォームへの参照を取得し、そのフォームまたはそのコントロールに対してアクションを実行できます。
アプリケーションがマルチ ドキュメント インターフェイス (MDI: Multiple Document Interface) アプリケーションの場合は、ActiveMdiChild プロパティを使用して現在アクティブな MDI 子フォームを取得できます。

アクティブなフォームを取得し、そのフォーム上のすべてのコントロールを無効にするコード例を次に示します。この例では、フォームの Controls コレクションを使用して、フォーム上の各コントロールを反復処理して、それぞれを無効にします。
Public Sub DisableActiveFormControls() ' Create an instance of a form and assign it the currently active form. Dim currentForm As Form = Form.ActiveForm ' Loop through all the controls on the active form. Dim i As Integer For i = 0 To currentForm.Controls.Count - 1 ' Disable each control in the active form's control collection. currentForm.Controls(i).Enabled = False Next i End Sub 'DisableActiveFormControls
public void DisableActiveFormControls() { // Create an instance of a form and assign it the currently active form. Form currentForm = Form.ActiveForm; // Loop through all the controls on the active form. for (int i = 0; i < currentForm.Controls.Count; i++) { // Disable each control in the active form's control collection. currentForm.Controls[i].Enabled = false; } }
void DisableActiveFormControls() { // Create an instance of a form and assign it the currently active form. Form^ currentForm = Form::ActiveForm; // Loop through all the controls on the active form. for ( int i = 0; i < currentForm->Controls->Count; i++ ) { // Disable each control in the active form's control collection. currentForm->Controls[ i ]->Enabled = false; } }
public void DisableActiveFormControls() { // Create an instance of a form and assign it the currently // active form. Form currentForm = Form.get_ActiveForm(); // Loop through all the controls on the active form. for (int i = 0; i < currentForm.get_Controls().get_Count(); i++) { // Disable each control in the active form's control collection. currentForm.get_Controls().get_Item(i).set_Enabled(false); } } //DisableActiveFormControls


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からForm.ActiveForm プロパティを検索する場合は、下記のリンクをクリックしてください。

- Form.ActiveForm プロパティのページへのリンク