home *** CD-ROM | disk | FTP | other *** search
/ ftp.tcs3.com / ftp.tcs3.com.tar / ftp.tcs3.com / DRIVERS / Audio / Office2010 / InfoPath.en-us / InfLR.cab / FL_DrawaShapewithGradientFill_snippet_142659_ENU____.3643236F_FC70_11D3_A536_0090278A1BB8 < prev    next >
Extensible Markup Language  |  2008-09-17  |  3KB  |  79 lines

  1. <?xml version="1.0"?>
  2. <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  3.   <CodeSnippet Format="1.0.0">
  4.     <Header>
  5.       <Title>Draw a Shape with Gradient Fill</Title>
  6.       <Author>Microsoft Corporation</Author>
  7.       <Description>Draws a shape with gradient fill.</Description>
  8.       <Shortcut>drawGrad</Shortcut>
  9.     </Header>
  10.     <Snippet>
  11.       <References>
  12.         <Reference>
  13.           <Assembly>System.Windows.Forms</Assembly>
  14.         </Reference>
  15.         <Reference>
  16.           <Assembly>System.Drawing</Assembly>
  17.         </Reference>
  18.       </References>
  19.       <Imports>
  20.         <Import>
  21.           <Namespace>Microsoft.VisualBasic</Namespace>
  22.         </Import>
  23.         <Import>
  24.           <Namespace>System.Drawing.Drawing2D</Namespace>
  25.         </Import>
  26.         <Import>
  27.           <Namespace>System.Drawing</Namespace>
  28.         </Import>
  29.         <Import>
  30.           <Namespace>System.Windows.Forms</Namespace>
  31.         </Import>
  32.       </Imports>
  33.       <Declarations>
  34.         <Literal>
  35.           <ID>x</ID>
  36.           <ToolTip>Replace with x-coorditnate of the left side of the rectangle.</ToolTip>
  37.           <Default>0</Default>
  38.         </Literal>
  39.         <Literal>
  40.           <ID>y</ID>
  41.           <ToolTip>Replace with y-coorditnate of the top of the rectangle.</ToolTip>
  42.           <Default>0</Default>
  43.         </Literal>
  44.         <Literal>
  45.           <ID>width</ID>
  46.           <ToolTip>Replace with width of the rectangle.</ToolTip>
  47.           <Default>100</Default>
  48.         </Literal>
  49.         <Literal>
  50.           <ID>height</ID>
  51.           <ToolTip>Replace with the height of the rectangle.</ToolTip>
  52.           <Default>100</Default>
  53.         </Literal>
  54.         <Literal>
  55.           <ID>color1</ID>
  56.           <ToolTip>Replace with the first color of the gradient.</ToolTip>
  57.           <Default>Color.Blue</Default>
  58.         </Literal>
  59.         <Literal>
  60.           <ID>color2</ID>
  61.           <ToolTip>Replace with the second color of the gradient.</ToolTip>
  62.           <Default>Color.Black</Default>
  63.         </Literal>
  64.         <Literal>
  65.           <ID>form</ID>
  66.           <Type>Form</Type>
  67.           <ToolTip>Replace with form or control to draw the shape on</ToolTip>
  68.           <Default>Me</Default>
  69.         </Literal>
  70.       </Declarations>
  71.       <Code Language="VB" Kind="method body"><![CDATA[    Dim rect As New Rectangle($x$, $y$, $width$, $height$)
  72.     Dim gc As Graphics = $form$.CreateGraphics
  73.  
  74.     Dim gradientBrush As New LinearGradientBrush(rect, $color1$, $color2$, LinearGradientMode.Horizontal)
  75.     gc.FillRectangle(gradientBrush, rect)
  76. ]]></Code>
  77.     </Snippet>
  78.   </CodeSnippet>
  79. </CodeSnippets>