| Flash for .NET Task-Based Help > C1FlashCanvas Tasks > Drawing Text in C1FlashCanvas > Drawing Text Inside a Rectangle |
To draw text inside of a rectangle, use the DrawRectangle method to draw a rectangle and call the DrawString method to draw text into the rectangle:
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Imports C1.C1Flash
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim font As New Font("MS Sans Serif", 14)
Dim rect As New Rectangle(50, 120, 200, 75)
Me.C1FlashCanvas1.DrawRectangle(Pens.Black, rect)
Me.C1FlashCanvas1.DrawString("Text in the rectangle", font, Brushes.DarkOrange, rect)
font.Dispose()
End Sub
|
|
To write code in C#
| C# |
Copy Code
|
|---|---|
using C1.C1Flash;
private void Form1_Load(object sender, System.EventArgs e)
{
Font font = new Font("MS Sans Serif", 14);
Rectangle rect = new Rectangle(50, 120, 200, 75);
this.c1FlashCanvas1.DrawRectangle(Pens.Black, rect);
this.c1FlashCanvas1.DrawString("Text in the rectangle", font, Brushes.DarkOrange, rect);
font.Dispose();
}
|
|
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Me.C1FlashCanvas1.RenderToFile("c:\WindowsApplication1.swf")
LaunchViewer("c:\WindowsApplication1.swf")
|
|
To write code in C#
| C# |
Copy Code
|
|---|---|
this.c1FlashCanvas1.RenderToFile(@"c:\WindowsApplication1.swf"); LaunchViewer(@"c:\WindowsApplication1.swf"); |
|
Here is what your text will look like in Internet Explorer:
