private void SlideForm_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e) { if (SlideOutEnable) { e.Cancel = closeFlag; if (closeFlag) { currentMode = false; _timer.Enabled = true; _timer.Start(); if (SlideBegin != null) { SlideBegin.Invoke(this, new SlideFinishedEventArgs(SlideDirection.SlideOut)); } } } }
private void SlideForm_Load(System.Object sender, System.EventArgs e) { workRect = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea; sizeW = _attachedForm.Width; sizeH = _attachedForm.Height; //计算起点 if (xFrom == 0) { if (_DirectX == FlyXDirection.LeftToRight) { xFrom = workRect.Left - sizeW; } else { if (_DirectX == FlyXDirection.None) { xFrom = workRect.Right - sizeW; } else { xFrom = workRect.Right; } } } if (yFrom == 0) { if (_DirectY == FlyYDirection.TopToBottom) { yFrom = workRect.Top - sizeH; } else { if (_DirectY == FlyYDirection.None) { yFrom = workRect.Bottom - sizeH; } else { yFrom = workRect.Bottom; } } } //计算终点 if (_DirectY != FlyYDirection.None) { if (_DirectY == FlyYDirection.TopToBottom) { yTo = yFrom + sizeH; } else { yTo = yFrom - sizeH; } } else { yTo = yFrom; } if (_DirectX != FlyXDirection.None) { if (_DirectX == FlyXDirection.LeftToRight) { xTo = xFrom + sizeW; } else { xTo = xFrom - sizeW; } } else { xTo = xFrom; } //重置当前窗体位置 if (SlideInEnable) { _attachedForm.Location = new Point(xFrom, yFrom); closeFlag = true; //开始计时器 currentMode = true; _timer.Enabled = true; _timer.Start(); if (SlideBegin != null) { SlideBegin.Invoke(this, new SlideFinishedEventArgs(SlideDirection.SlideIn)); } } else { currentMode = false; _attachedForm.Location = new Point(xTo, yTo); currentMode = false; closeFlag = true; } }
private void DrawNote(PaintEventArgs e) { switch (noteType) { case NoteType.TAP: Tap.Draw(e, new PointF(previewBox.Width / 2f, previewBox.Height / 2f), new SizeF(80, 10)); break; case NoteType.EXTAP: ExTap.Draw(e, new PointF(previewBox.Width / 2f, previewBox.Height / 2f), new SizeF(80, 10)); break; case NoteType.EXTAPDOWN: ExTapDown.Draw(e, new PointF(previewBox.Width / 2f, previewBox.Height / 2f), new SizeF(80, 10)); break; case NoteType.AWEXTAP: AwesomeExTap.Draw(e, new PointF(previewBox.Width / 2f, previewBox.Height / 2f), new SizeF(80, 10)); break; case NoteType.FLICK: Flick.Draw(e, new PointF(previewBox.Width / 2f, previewBox.Height / 2f), new SizeF(80, 10)); break; case NoteType.HELL: HellTap.Draw(e, new PointF(previewBox.Width / 2f, previewBox.Height / 2f), new SizeF(80, 10)); break; case NoteType.HOLD: Hold.Draw(e, new PointF(previewBox.Width / 2f, previewBox.Height / 2f - 25), new SizeF(70, 50)); HoldBegin.Draw(e, new PointF(previewBox.Width / 2f, previewBox.Height / 2f), new SizeF(80, 10)); break; case NoteType.SLIDE: Slide.Draw(e, new PointF(previewBox.Width / 2f, previewBox.Height / 2f - 25), new SizeF(70, 50)); SlideBegin.Draw(e, new PointF(previewBox.Width / 2f, previewBox.Height / 2f), new SizeF(80, 10)); break; case NoteType.SLIDECURVE: SlideCurve.Draw(e, new PointF(previewBox.Width / 2f, previewBox.Height / 2f), new SizeF(80, 10)); break; #region Air系の描画 //HACK: いろいろとコードがガバガバなので後で直してもええんやで... case NoteType.AIRUPL: new AirUpL(8, new Position(), new PointF(previewBox.Width / 2f - 4 * 12, previewBox.Height / 2f + 15), -1).Draw(e.Graphics, new Point()); break; case NoteType.AIRUPC: new AirUpC(8, new Position(), new PointF(previewBox.Width / 2f - 4 * 12, previewBox.Height / 2f + 15), -1).Draw(e.Graphics, new Point()); break; case NoteType.AIRUPR: new AirUpR(8, new Position(), new PointF(previewBox.Width / 2f - 4 * 12, previewBox.Height / 2f + 15), -1).Draw(e.Graphics, new Point()); break; case NoteType.AIRDOWNL: new AirDownL(8, new Position(), new PointF(previewBox.Width / 2f - 4 * 12, previewBox.Height / 2f + 15), -1).Draw(e.Graphics, new Point()); break; case NoteType.AIRDOWNC: new AirDownC(8, new Position(), new PointF(previewBox.Width / 2f - 4 * 12, previewBox.Height / 2f + 15), -1).Draw(e.Graphics, new Point()); break; case NoteType.AIRDOWNR: new AirDownR(8, new Position(), new PointF(previewBox.Width / 2f - 4 * 12, previewBox.Height / 2f + 15), -1).Draw(e.Graphics, new Point()); break; #endregion case NoteType.AIRHOLD: AirHold.Draw(e, new PointF(previewBox.Width / 2f, previewBox.Height / 2f + 25), new SizeF(7, 50)); AirAction.Draw(e, new PointF(previewBox.Width / 2f, previewBox.Height / 2f), new SizeF(78, 8)); break; // HACK: 色や座標に即値を使っているのでよくない case NoteType.BPM: e.Graphics.DrawLine( Pens.LimeGreen, (previewBox.Width - 100) / 2f, previewBox.Height / 2f, (previewBox.Width + 100) / 2f, previewBox.Height / 2f); break; // HACK: 同上 case NoteType.HIGHSPEED: e.Graphics.DrawLine( Pens.Red, (previewBox.Width - 100) / 2f, previewBox.Height / 2f, (previewBox.Width + 100) / 2f, previewBox.Height / 2f); break; default: break; } }