<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>确定活动的 MDI 子窗体和控件</Title>
      <Author>Microsoft Corporation</Author>
      <Description>检索活动的 MDI 子窗体和该子窗体上的活动控件。</Description>
      <Shortcut>mdiActive</Shortcut>
    </Header>
    <Snippet>
      <References>
        <Reference>
          <Assembly>System.Drawing.dll</Assembly>
        </Reference>
        <Reference>
          <Assembly>System.Windows.Forms.dll</Assembly>
        </Reference>
        <Reference>
          <Assembly>System.dll</Assembly>
        </Reference>
      </References>
      <Imports>
        <Import>
          <Namespace>Microsoft.VisualBasic</Namespace>
        </Import>
        <Import>
          <Namespace>System.Drawing</Namespace>
        </Import>
        <Import>
          <Namespace>System.Windows.Forms</Namespace>
        </Import>
        <Import>
          <Namespace>System</Namespace>
        </Import>
      </Imports>
      <Declarations>
        <Object>
          <ID>formName</ID>
          <Type>Form</Type>
          <ToolTip>替换为对 MDI 父窗体的引用。</ToolTip>
          <Default>Me</Default>
        </Object>
      </Declarations>
      <Code Language="VB" Kind="method body"><![CDATA[Dim activeChild As Form = $formName$.ActiveMdiChild

Dim activeControl As Control = Nothing
If Not activeChild IsNot Nothing Then
    activeControl = activeChild.ActiveControl
End If
]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>
