| Flash for .NET Task-Based Help > C1FlashSlide Tasks > Creating Slide Documents with Navigation Buttons |
This topic demonstrates the methods of creating a slideshow that has navigation buttons. To create a four-page slideshow with navigation buttons, complete the following steps:
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Imports C1.C1Flash
Private Sub AddPage0()
' Create page 0
Dim page As FPage = C1FlashSlide1.AddPage()
Dim rect As New Rectangle(100, 100, 350, 80)
Dim text As String = "This sample demonstrates how to create a slideshow using C1FlashSlide component."
Dim font As New Font("MS Sans Serif", 14)
page.DrawString(text, font, Brushes.Black, rect)
rect.Offset(0, 80)
text = "Some of the pages are copied from other C1FlashCanvas samples."
page.DrawString(text, font, Brushes.Black, rect)
rect.Offset(0, 80)
text = "Press <Next> button to go next page."
page.DrawString(text, font, Brushes.Black, rect)
font.Dispose()
End Sub
|
|
To write code in C#
| C# |
Copy Code
|
|---|---|
using C1.C1Flash;
private void AddPage0()
{
// Create page 0
FPage page = c1FlashSlide1.AddPage();
Rectangle rect = new Rectangle(100, 100, 350, 80);
string text = "This sample demonstrates how to create a slideshow using C1FlashSlide component.";
Font font = new Font("MS Sans Serif", 14);
page.DrawString(text, font, Brushes.Black, rect);
rect.Offset(0, 80);
text = "Some of the pages are copied from other C1FlashCanvas samples.";
page.DrawString(text, font, Brushes.Black, rect);
rect.Offset(0, 80);
text = "Press <Next> button to go next page.";
page.DrawString(text, font, Brushes.Black, rect);
font.Dispose();
}
|
|
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Private Sub AddPage1()
' Create page 1
Dim page As FPage = C1FlashSlide1.AddPage()
Dim rect As New Rectangle(100, 50, 350, 80)
Dim text As String = "This page illustrates an image drawn by the DrawChord method."
Dim font As New Font("MS Sans Serif", 12)
page.DrawString(text, font, Brushes.Black, rect)
Dim a As [Assembly] = [Assembly].GetExecutingAssembly()
Dim an As String = a.GetName().Name
Dim bmp As New Bitmap(a.GetManifestResourceStream((an + ".DrawChordMethodGraphic.bmp")))
page.DrawImage(bmp, New Point(120, 120))
bmp.Dispose()
font.Dispose()
End Sub
Private Sub AddPage2()
' Create page 2
Dim page As FPage = C1FlashSlide1.AddPage()
Dim rect As New Rectangle(100, 50, 350, 80)
Dim text As String = "This page illustrates an image drawn by the DrawEllipse method."
Dim font As New Font("MS Sans Serif", 12)
page.DrawString(text, font, Brushes.Black, rect)
Dim a As [Assembly] = [Assembly].GetExecutingAssembly()
Dim an As String = a.GetName().Name
Dim bmp As New Bitmap(a.GetManifestResourceStream((an + ".DrawEllipseMethodgraphic.bmp")))
page.DrawImage(bmp, New Point(100, 120))
bmp.Dispose()
font.Dispose()
End Sub
|
|
To write code in C#
| C# |
Copy Code
|
|---|---|
private void AddPage1()
{
// Create page 1
FPage page = c1FlashSlide1.AddPage();
Rectangle rect = new Rectangle(100, 50, 350, 80);
string text = "This page illustrates an image drawn by the DrawChord method.";
Font font = new Font("MS Sans Serif", 12);
page.DrawString(text, font, Brushes.Black, rect);
Assembly a = Assembly.GetExecutingAssembly();
string an = a.GetName().Name;
Bitmap bmp = new Bitmap(a.GetManifestResourceStream(an + ".DrawChordMethodGraphic.bmp"));
page.DrawImage(bmp, new Point(120, 120));
bmp.Dispose();
font.Dispose();
}
private void AddPage2()
{
// Create page 2
FPage page = c1FlashSlide1.AddPage();
Rectangle rect = new Rectangle(100, 50, 350, 80);
string text = "This page illustrates an image drawn by the DrawEllipse method.";
Font font = new Font("MS Sans Serif", 12);
page.DrawString(text, font, Brushes.Black, rect);
Assembly a = Assembly.GetExecutingAssembly();
string an = a.GetName().Name;
Bitmap bmp = new Bitmap(a.GetManifestResourceStream(an + ".DrawEllipseMethodgraphic.bmp"));
page.DrawImage(bmp, new Point(100, 120));
bmp.Dispose();
font.Dispose();
}
|
|
![]() |
Note: The bitmap has to be embedded in the Manifest of your assembly. From the Project | Add New Item menu, select Bitmap File and specify the .bmp file name. Right-click the file located in the Solution Explorer, and select Properties. Set the BuildAction property to Embedded Resource. |
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Private Sub AddPage3()
' Create page 3
Dim page As FPage = C1FlashSlide1.AddPage()
page.ResetTransform()
Dim ptCenter As New Point(page.Width / 2, page.Height / 6)
' Moves the coordination origin point to the center of the canvas.
page.TranslateTransform(ptCenter.X, ptCenter.Y)
Dim rect As New Rectangle(80, 140, 140, 180)
Dim i As Integer
For i = 0 To 11
' Draws the ellipse with the same ellipse parameter
page.DrawEllipse(Pens.Red, rect)
page.FillEllipse(Brushes.LightYellow, rect)
' Rotates the coordinition by 15 degrees
page.RotateTransform(15)
' Scales the coordinition
page.ScaleTransform(0.85F, 0.85F)
Next i
' Resets the coordinate
page.ResetTransform()
Dim i As Integer
For i = 1 To 11
page.DrawEllipse(Pens.Red, rect)
' Change the Transform
Dim m As Matrix = page.Transform
m.Shear(0.15F, 0.15F)
page.Transform = m
Next i
End Sub
|
|
To write code in C#
| C# |
Copy Code
|
|---|---|
private void AddPage3()
{
// Create page 3
FPage page = c1FlashSlide1.AddPage();
page.ResetTransform();
Point ptCenter = new Point(page.Width/2, page.Height/6);
// Moves the coordination origin point to the center of the canvas.
page.TranslateTransform(ptCenter.X, ptCenter.Y);
Rectangle rect = new Rectangle(80, 140, 140, 180);
for(int i = 0; i < 12; i++)
{
// Draws the ellipse with the same ellipse parameter
page.DrawEllipse(Pens.Red, rect);
page.FillEllipse(Brushes.LightYellow, rect);
// Rotates the coordinition by 15 degrees
page.RotateTransform(15);
// Scales the coordinition
page.ScaleTransform(0.85F, 0.85F);
}
// Resets the coordinate
page.ResetTransform();
for(int i = 1; i < 12; i++)
{
page.DrawEllipse(Pens.Red, rect);
// Change the Transform
Matrix m = page.Transform;
m.Shear(0.15F, 0.15F);
page.Transform = m;
}
}
|
|
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load C1FlashSlide1.Clean() Me.AddPage0() Me.AddPage1() Me.AddPage2() Me.AddPage3() End Sub |
|
To write code in C#
| C# |
Copy Code
|
|---|---|
private void Form1_Load(object sender, System.EventArgs e)
{
c1FlashSlide1.Clean();
this.AddPage0();
this.AddPage1();
this.AddPage2();
this.AddPage3();
}
|
|
Here is what your slideshow will look like, page by page.
Opening page

Page 1

Page 2

Page 3
