init: 导入项目到 meswork Gitea
This commit is contained in:
104
DataMirrorTools_Simulator/GanttChartExample/ExampleFull.Play.cs
Normal file
104
DataMirrorTools_Simulator/GanttChartExample/ExampleFull.Play.cs
Normal file
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Braincase.GanttChart
|
||||
{
|
||||
public partial class ExampleFull
|
||||
{
|
||||
|
||||
private void textBox_TimeInterval_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
//if()
|
||||
//InitPlay();
|
||||
}
|
||||
private void _mChart_PlaySliderMouseDrag(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (_mManager.MaxPlayLenth < 0.0001) return;
|
||||
textBox_NowIndex.Text = _mManager.NowIndex.ToString();
|
||||
textBox_CurrentTime.Text = ((float)_mManager.NowIndex * _mManager.TimeInterval).ToString();
|
||||
|
||||
float timeX;
|
||||
timeX = (_mManager.NowIndexXf * _mManager.MaxCountLenth) / _mManager.MaxPlayLenth;
|
||||
_mChart.Invalidate();
|
||||
}
|
||||
private void InitPlay()
|
||||
{
|
||||
|
||||
if (!_mManager.IsPlaye)
|
||||
{
|
||||
_mManager.NowIndex = 0;
|
||||
}
|
||||
SetMaxCountLenth();
|
||||
_mManager.NowIndexXf = _mManager.NowIndex * _mManager.TimeInterval * (_mManager.MaxCountLenth / (float)_mManager.AllCountFrame);
|
||||
}
|
||||
private void pictureBox_Play_Click(object sender, EventArgs e)
|
||||
{
|
||||
InitPlay();
|
||||
_mManager.IsPlaye = true;
|
||||
//int Interval = (int)(_mManager.TimeInterval * 1000);
|
||||
timer_Play.Interval = 30;
|
||||
timer_Play.Enabled = true;
|
||||
pictureBox_Pause.Enabled = true;
|
||||
pictureBox_Stop.Enabled = true;
|
||||
_mManager.IsLastPlaye = false;
|
||||
}
|
||||
private void pictureBox_Pause_Click(object sender, EventArgs e)
|
||||
{
|
||||
timer_Play.Enabled = false;
|
||||
|
||||
}
|
||||
private void pictureBox_Stop_Click(object sender, EventArgs e)
|
||||
{
|
||||
pictureBox_Pause.Enabled = false;
|
||||
pictureBox_Stop.Enabled = false;
|
||||
timer_Play.Enabled = false;
|
||||
_mManager.NowIndex = 0;
|
||||
_mManager.IsPlaye = false;
|
||||
_mChart.Invalidate();
|
||||
|
||||
}
|
||||
// int indexTest = 0;
|
||||
int indexOneFrameCount = 1;
|
||||
int indexOneFrameCountBase = 2;
|
||||
private void timer_Play_Tick(object sender, EventArgs e)
|
||||
{
|
||||
_mManager.NowIndexXf = _mManager.NowIndex * _mManager.MaxCountLenth/(float)_mManager.AllCountFrame;
|
||||
|
||||
//时间屏幕坐标点坐标 X
|
||||
_mManager.NowIndexXf = _mManager.NowIndexXf * _mChart.BarWidth / _mChart.HeaderScale;
|
||||
//_mManager.NowIndexXf = _mManager.NowIndex * _mManager.TimeInterval * ((float)_mManager.AllCountFrame / _mManager.MaxCountLenth);
|
||||
textBox_NowIndex.Text = _mManager.NowIndex.ToString();
|
||||
float currentTime = (float)(_mManager.NowIndex + 1) * _mManager.TimeInterval;
|
||||
if(currentTime>= _mManager.MaxCountLenth)
|
||||
{
|
||||
textBox_CurrentTime.Text = _mManager.MaxCountLenth.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
textBox_CurrentTime.Text = currentTime.ToString();
|
||||
}
|
||||
_mManager.NowIndex = _mManager.NowIndex + indexOneFrameCount+ indexOneFrameCountBase;
|
||||
if (_mManager.IsLastPlaye)
|
||||
{
|
||||
_mManager.IsLastPlaye = false;
|
||||
timer_Play.Enabled = false;
|
||||
_mManager.NowIndex = 0;
|
||||
}
|
||||
else if (_mManager.NowIndex > _mManager.AllCountFrame)
|
||||
{
|
||||
_mManager.NowIndex = _mManager.AllCountFrame;
|
||||
_mManager.IsLastPlaye = true;
|
||||
}
|
||||
|
||||
_mChart.Invalidate();
|
||||
}
|
||||
private void numericUpDown_indexOneFrameCount_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
indexOneFrameCount = (int)numericUpDown_indexOneFrameCount.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user