1
// ------------------------------------------------------------------
2 // Copyright (C) 2011-2015 Maruko Toolbox Project
4 // Authors: komaruchan <sandy_0308@hotmail.com>
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
10 // http://www.apache.org/licenses/LICENSE-2.0
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
15 // express or implied.
16 // See the License for the specific language governing permissions
17 // and limitations under the License.
18 // -------------------------------------------------------------------
22 using System
.Collections
.Generic
;
23 using System
.ComponentModel
;
27 using System
.Windows
.Forms
;
28 using System
.Drawing
.Drawing2D
;
33 public partial class SplashForm
: Form
35 public static class ClassStyles
37 public static readonly Int32
38 CS_BYTEALIGNCLIENT
= 0x1000,
39 CS_BYTEALIGNWINDOW
= 0x2000,
42 CS_DROPSHADOW
= 0x00020000,
43 CS_GLOBALCLASS
= 0x4000,
52 protected override CreateParams CreateParams
56 CreateParams cp
= base.CreateParams
;
57 cp
.ClassStyle
|= ClassStyles
.CS_DROPSHADOW
;
65 InitializeComponent();
67 this.FormBorderStyle
= FormBorderStyle
.None
;
69 this.StartPosition
= FormStartPosition
.CenterScreen
;
73 private void SplashForm_Load(object sender
, EventArgs e
)
75 ArtTextLabel TitleLabel
= new ArtTextLabel();
76 TitleLabel
.AutoSize
= true;
77 TitleLabel
.Font
= new Font("微软雅黑", 21.75F
, FontStyle
.Regular
, GraphicsUnit
.Point
, ((byte)(134)));
78 TitleLabel
.ForeColor
= Color
.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(241)))), ((int)(((byte)(191)))));
79 TitleLabel
.BackColor
= Color
.Transparent
;
80 TitleLabel
.Location
= new Point(300, 110);
81 TitleLabel
.Name
= "TitleLabel";
82 TitleLabel
.Size
= new Size(208, 29);
83 TitleLabel
.TabIndex
= 2;
84 TitleLabel
.Text
= "小丸工具箱";
85 TitleLabel
.Parent
= pictureBox
;
87 LuneartTextLabel
.Parent
= pictureBox
;
90 private void timer_Tick(object sender
, EventArgs e
)
92 this.InvokeIfRequired(() =>
103 //this.Opacity = 1 - Convert.ToDouble(iCount) / 1000;
106 private void SplashForm_Paint(object sender
, PaintEventArgs e
)
108 List
<Point
> list
= new List
<Point
>();
109 int width
= this.Width
;
110 int height
= this.Height
;
114 list
.Add(new Point(0, 5));
115 list
.Add(new Point(1, 5));
116 list
.Add(new Point(1, 3));
117 list
.Add(new Point(2, 3));
118 list
.Add(new Point(2, 2));
119 list
.Add(new Point(3, 2));
120 list
.Add(new Point(3, 1));
121 list
.Add(new Point(5, 1));
122 list
.Add(new Point(5, 0));
124 list
.Add(new Point(width
- 5, 0));
125 list
.Add(new Point(width
- 5, 1));
126 list
.Add(new Point(width
- 3, 1));
127 list
.Add(new Point(width
- 3, 2));
128 list
.Add(new Point(width
- 2, 2));
129 list
.Add(new Point(width
- 2, 3));
130 list
.Add(new Point(width
- 1, 3));
131 list
.Add(new Point(width
- 1, 5));
132 list
.Add(new Point(width
- 0, 5));
134 list
.Add(new Point(width
- 0, height
- 5));
135 list
.Add(new Point(width
- 1, height
- 5));
136 list
.Add(new Point(width
- 1, height
- 3));
137 list
.Add(new Point(width
- 2, height
- 3));
138 list
.Add(new Point(width
- 2, height
- 2));
139 list
.Add(new Point(width
- 3, height
- 2));
140 list
.Add(new Point(width
- 3, height
- 1));
141 list
.Add(new Point(width
- 5, height
- 1));
142 list
.Add(new Point(width
- 5, height
- 0));
144 list
.Add(new Point(5, height
- 0));
145 list
.Add(new Point(5, height
- 1));
146 list
.Add(new Point(3, height
- 1));
147 list
.Add(new Point(3, height
- 2));
148 list
.Add(new Point(2, height
- 2));
149 list
.Add(new Point(2, height
- 3));
150 list
.Add(new Point(1, height
- 3));
151 list
.Add(new Point(1, height
- 5));
152 list
.Add(new Point(0, height
- 5));
154 Point
[] points
= list
.ToArray();
155 GraphicsPath shape
= new GraphicsPath();
156 shape
.AddPolygon(points
);
157 this.Region
= new System
.Drawing
.Region(shape
);
160 private void pictureBox_DoubleClick(object sender
, EventArgs e
)
162 if (this.Owner
!= null)
166 private void Type(Control sender
, int p_1
, double p_2
)
168 GraphicsPath oPath
= new GraphicsPath();
169 oPath
.AddClosedCurve(
171 new Point(0, sender
.Height
/ p_1
),
172 new Point(sender
.Width
/ p_1
, 0),
173 new Point(sender
.Width
- sender
.Width
/ p_1
, 0),
174 new Point(sender
.Width
, sender
.Height
/ p_1
),
175 new Point(sender
.Width
, sender
.Height
- sender
.Height
/ p_1
),
176 new Point(sender
.Width
- sender
.Width
/ p_1
, sender
.Height
),
177 new Point(sender
.Width
/ p_1
, sender
.Height
),
178 new Point(0, sender
.Height
- sender
.Height
/ p_1
) },
182 sender
.Region
= new Region(oPath
);
188 class ArtTextLabel
: Label
191 Color _borderColor
= Color
.Gray
;
192 protected override void OnPaint(PaintEventArgs pe
)
195 PointF pt
= new PointF(0, 0);
196 RenderRelievoText(pe
.Graphics
, pt
);
201 private void RenderBordText(Graphics g
, PointF point
)
203 using (Brush brush
= new SolidBrush(_borderColor
))
205 for (int i
= 1; i
<= _borderSize
; i
++)
233 using (Brush brush
= new SolidBrush(base.ForeColor
))
236 base.Text
, base.Font
, brush
, point
);
241 private void RenderFormeText(Graphics g
, PointF point
)
243 using (Brush brush
= new SolidBrush(_borderColor
))
245 for (int i
= 1; i
<= _borderSize
; i
++)
255 using (Brush brush
= new SolidBrush(base.ForeColor
))
258 base.Text
, base.Font
, brush
, point
);
264 private void RenderRelievoText(Graphics g
, PointF point
)
266 using (Brush brush
= new SolidBrush(_borderColor
))
268 for (int i
= 1; i
<= _borderSize
; i
++)
284 using (Brush brush
= new SolidBrush(base.ForeColor
))
287 base.Text
, base.Font
, brush
, point
);