<?xml version="1.0"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>Access an Embedded Resource</Title>
      <Author>Microsoft Corporation</Author>
      <Description>Shows how to get an embedded resource, .bmp file, and display it in a PictureBox.</Description>
      <Shortcut>sdres</Shortcut>
    </Header>
    <Snippet>
      <References>
        <Reference>
          <Assembly>System.Windows.Forms.dll</Assembly>
        </Reference>
      </References>
      <Imports>
        <Import>
          <Namespace>Microsoft.VisualBasic</Namespace>
        </Import>
        <Import>
          <Namespace>System</Namespace>
        </Import>
        <Import>
          <Namespace>System.Drawing</Namespace>
        </Import>
        <Import>
          <Namespace>System.Reflection</Namespace>
        </Import>
        <Import>
          <Namespace>System.Windows.Forms</Namespace>
        </Import>
      </Imports>
      <Declarations>
        <Object>
          <ID>PictureBox</ID>
          <Type>System.Windows.Forms.PictureBox</Type>
          <ToolTip>Replace with a PictureBox control on your form.</ToolTip>
          <Default>PictureBox1</Default>
        </Object>
        <Literal>
          <ID>resource</ID>
          <Type>System.String</Type>
          <ToolTip>Replace with name of embedded resource in the format: namespace.filename.extension</ToolTip>
          <Default>DeviceApplication1.mypicture.bmp</Default>
        </Literal>
      </Declarations>
      <Code Language="VB" Kind="method decl"><![CDATA[Private Sub LoadPicture()
    Dim bmpSource As Bitmap
    Dim asm As System.Reflection.Assembly 
    asm = System.Reflection.Assembly.GetExecutingAssembly()

    $PictureBox$.SizeMode = PictureBoxSizeMode.StretchImage
    Try
        bmpSource = New Bitmap(asm.GetManifestResourceStream("$resource$"))
        $PictureBox$.Image = bmpSource
    Catch ex As NullReferenceException
        End Try
End Sub]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>