|
@@ -13,13 +13,12 @@ namespace ScreenSaverEf
|
|
|
PointF _posSky;
|
|
|
PointF _posDn;
|
|
|
|
|
|
- PointF _posShyr;
|
|
|
- PointF _posDnr;
|
|
|
+ PointF _posSkyReset;
|
|
|
+ PointF _posDnReset;
|
|
|
|
|
|
PointF _posC = PointF.Empty;
|
|
|
PointF _posCr;
|
|
|
-
|
|
|
- Rectangle _blkUp;
|
|
|
+
|
|
|
Rectangle _blkDn;
|
|
|
|
|
|
#region POSC_DATA
|
|
@@ -81,14 +80,14 @@ namespace ScreenSaverEf
|
|
|
|
|
|
|
|
|
ResetPos();
|
|
|
- timer1.Start();
|
|
|
+ UpdateTimer.Start();
|
|
|
}
|
|
|
|
|
|
private void ResetPos()
|
|
|
{
|
|
|
- _posShyr = _posSky = new PointF(-_imgSky.Width + Width, (Height - 600) / 2);
|
|
|
- _posDnr = _posDn = new PointF(-_imgDn.Width + Width, (Height - 600) / 2);
|
|
|
- _posCr = new PointF(Width - _imgC.Width, (Height - 600) / 2);
|
|
|
+ _posSkyReset = _posSky = new PointF(-_imgSky.Width + Width, (Height - 600) / 2f);
|
|
|
+ _posDnReset = _posDn = new PointF(-_imgDn.Width + Width, (Height - 600) / 2f);
|
|
|
+ _posCr = new PointF(Width - _imgC.Width, (Height - 600) / 2f);
|
|
|
|
|
|
_blkDn = new Rectangle(new Point(0, (int)_posSky.Y + _imgSky.Height), new Size(Width, (Height - 600) / 2));
|
|
|
}
|
|
@@ -114,20 +113,20 @@ namespace ScreenSaverEf
|
|
|
|
|
|
private void Form1_Paint(object sender, PaintEventArgs e)
|
|
|
{
|
|
|
- Graphics dc = e.Graphics;
|
|
|
- if (timer1.Enabled)
|
|
|
+ var dc = e.Graphics;
|
|
|
+ if (UpdateTimer.Enabled)
|
|
|
{
|
|
|
if (_posSky.X > 0 && _posSky.X <= Width)
|
|
|
dc.DrawImage(_imgSky, new PointF(-_imgSky.Width + _posSky.X, _posSky.Y));
|
|
|
if (_posSky.X > Width)
|
|
|
- _posSky.X = _posShyr.X;
|
|
|
+ _posSky.X = _posSkyReset.X;
|
|
|
|
|
|
dc.DrawImage(_imgSky, _posSky);
|
|
|
|
|
|
if (_posDn.X > 0 && _posDn.X <= Width)
|
|
|
dc.DrawImage(_imgDn, new PointF(-_imgDn.Width + _posDn.X, _posDn.Y));
|
|
|
if (_posDn.X > Width)
|
|
|
- _posDn.X = _posDnr.X;
|
|
|
+ _posDn.X = _posDnReset.X;
|
|
|
|
|
|
dc.DrawImage(_imgDn, _posDn);
|
|
|
|
|
@@ -138,16 +137,16 @@ namespace ScreenSaverEf
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- dc.DrawString("点击开始", new Font("微软雅黑", 20), Brushes.White, ClientSize.Width / 2, ClientSize.Height / 2);
|
|
|
+ dc.DrawString("点击开始", new Font("微软雅黑", 20), Brushes.White, ClientSize.Width / 2f, ClientSize.Height / 2f);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void Form1_MouseClick(object sender, MouseEventArgs e)
|
|
|
{
|
|
|
- if (timer1.Enabled)
|
|
|
+ if (UpdateTimer.Enabled)
|
|
|
Application.Exit();
|
|
|
else
|
|
|
- timer1.Start();
|
|
|
+ UpdateTimer.Start();
|
|
|
}
|
|
|
|
|
|
private void Form1_Resize(object sender, EventArgs e)
|