-
Notifications
You must be signed in to change notification settings - Fork 123
/
Copy pathForm1.cs
128 lines (117 loc) · 4.13 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Syncfusion.Windows.Forms.Tools;
using Syncfusion.Windows.Forms;
using System.Threading;
using Syncfusion.WinForms.Controls;
namespace SuccinitySeries
{
public partial class Form1 : SfForm
{
int i = 0;
Dictionary<Image, string> filePath;
Image SelectedImage;
public Form1()
{
InitializeComponent();
Rectangle rect = System.Windows.Forms.Screen.PrimaryScreen.Bounds;
this.MinimumSize = new Size(rect.Width * 2 / 3, rect.Height * (3 / 2));
this.Location = new Point(rect.Width / 6, 0);
try
{
#if NETCORE
System.Drawing.Icon ico = new System.Drawing.Icon("../../../grid.ico");
#else
System.Drawing.Icon ico = new System.Drawing.Icon("../../grid.ico");
#endif
this.Icon = ico;
#if NETCORE
this.carousel1.BackgroundImage = new Bitmap("../../../Images/Background-image.png");
#else
this.carousel1.BackgroundImage = new Bitmap("../../Images/Background-image.png");
#endif
carousel1.BackgroundImageLayout = ImageLayout.Stretch;
carousel1.UseOriginalImageinPreview = false;
}
catch { }
filePath = new Dictionary<Image, string>();
foreach (var item in carousel1.ImageListCollection)
{
filePath.Add(item.ItemImage, "file" + i++);
}
this.carousel1.TransitionSpeed = 5;
}
#region event
private void carousel1_OnCarouselItemFocused(object sender, CarouselItemFocusedArgs e)
{
if(e.FocusedImage==SelectedImage)
{
if (filePath.ContainsKey(e.FocusedImage))
{
string fileName = filePath[e.FocusedImage];
Viewer view = new Viewer();
if (fileName == "file0")
{
fileName = "jQuery_Succinctly.pdf";
}
else if (fileName == "file1")
{
fileName = "GIS Succinctly.pdf";
}
else if (fileName == "file2")
{
fileName = "WindowsStoreApps_Succinctly.pdf";
}
else if (fileName == "file3")
{
fileName = "HTTP_Succinctly.pdf";
}
else if (fileName == "file4")
{
fileName = "JavaScript_Succinctly.pdf";
}
else if (fileName == "file5")
{
fileName = "LightSwitch_Succinctly.pdf";
}
else if (fileName == "file6")
{
fileName = "aspnetmvc4_Succinctly.pdf";
}
else if (fileName == "file7")
{
fileName = "iOS_Succinctly.pdf";
}
else if (fileName == "file8")
{
fileName = "Fsharp_Succinctly.pdf";
}
view.Show();
view.LoadPdf("PDF/" + fileName);
view.Text = fileName;
}
}
#endregion
}
private void carousel1_OnCarouselItemSelectionChanging(object sender, CarouselItemSelectionChangingArgs e)
{
SelectedImage = e.SelectedImage;
}
private void carousel1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawRectangle(new Pen(Color.Gray), e.ClipRectangle);
}
}
}