| Create Canvas Documents with C1FlashCanvas > Adding Images to C1FlashCanvas |
Adding images to C1FlashCanvas is done by using the DrawImage method.
DrawImage draws a given image at a specified location and with its original size or given size. For example, the following code loads a bitmap from resource and draws the image at a position:
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Dim a As [Assembly] = [Assembly].GetExecutingAssembly() Dim an As String = a.GetName().Name Dim bmp As New Bitmap(a.GetManifestResourceStream((an + ".lvhover.jpg"))) Dim c1logo As New Bitmap(a.GetManifestResourceStream((an + ".c1logo.jpg"))) canvas.DrawImage(c1logo, New Point(320, 10)) canvas.DrawImage(c1logo, New Rectangle(10, 10, 200, 60)) |
|
To write code in C#
| C# |
Copy Code
|
|---|---|
Assembly a = Assembly.GetExecutingAssembly(); string an = a.GetName().Name; Bitmap c1logo = new Bitmap(a.GetManifestResourceStream(an + ".c1logo.jpg")); canvas.DrawImage(c1logo, new Point(320, 10)); canvas.DrawImage(c1logo, new Rectangle(10, 10, 200, 60)); |
|
Notice that you can render any regular .NET Image object, including metafiles. Metafiles are not converted into bitmaps; they are played into the document and thus retain the best possible resolution. If you want to add charts or technical drawings to your Flash document, metafiles are better than bitmap images.