<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>在 Windows Form 上繪製文字</Title>
      <Author>Microsoft Corporation</Author>
      <Description>在表單上繪製文字。</Description>
      <Shortcut>drawText</Shortcut>
    </Header>
    <Snippet>
      <References>
        <Reference>
          <Assembly>System.Drawing.dll</Assembly>
        </Reference>
        <Reference>
          <Assembly>System.Windows.Forms.dll</Assembly>
        </Reference>
      </References>
      <Imports>
        <Import>
          <Namespace>System</Namespace>
        </Import>
        <Import>
          <Namespace>Microsoft.VisualBasic</Namespace>
        </Import>
        <Import>
          <Namespace>System.Drawing</Namespace>
        </Import>
        <Import>
          <Namespace>System.Windows.Forms</Namespace>
        </Import>
      </Imports>
      <Declarations>
        <Literal>
          <ID>FontName</ID>
          <Type>String</Type>
          <ToolTip>取代為字型名稱和大小。</ToolTip>
          <Default>"Arial"</Default>
        </Literal>
        <Literal>
          <ID>FontSize</ID>
          <Type>Integer</Type>
          <ToolTip>取代為字型大小。</ToolTip>
          <Default>16</Default>
        </Literal>
        <Object>
          <ID>text</ID>
          <Type>String</Type>
          <ToolTip>取代為要寫入的文字。</ToolTip>
          <Default>"hello"</Default>
        </Object>
        <Literal>
          <ID>Xlocation</ID>
          <Type>Single</Type>
          <ToolTip>取代為要讓文字出現的位置的 X 座標。</ToolTip>
          <Default>150.0</Default>
        </Literal>
        <Literal>
          <ID>Ylocation</ID>
          <Type>Single</Type>
          <ToolTip>取代為要讓文字出現的位置的 Y 座標。</ToolTip>
          <Default>50.0</Default>
        </Literal>
        <Literal>
          <ID>color</ID>
          <ToolTip>取代為文字的色彩。</ToolTip>
          <Default>Color.Red</Default>
        </Literal>
        <Object>
          <ID>form</ID>
          <Type>System.Windows.Forms.Form</Type>
          <ToolTip>對要在其上繪製文字的表單或控制項，取代為參考。</ToolTip>
          <Default>Me</Default>
        </Object>
      </Declarations>
      <Code Language="VB" Kind="method body"><![CDATA[    Dim drawFormat As New StringFormat()

    Using formGraphics As Graphics = $form$.CreateGraphics(), _
        drawFont As New System.Drawing.Font($FontName$, $FontSize$), _
        drawBrush As New SolidBrush($color$)

        formGraphics.DrawString($text$, drawFont, drawBrush, _
            $Xlocation$, $Ylocation$, drawFormat)
    End Using
]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>
