Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/259.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在c#winforms中基于DateTime值制作动态缩放时间轴面板_C#_Winforms_Datetime_Zooming_Timeline - Fatal编程技术网

如何在c#winforms中基于DateTime值制作动态缩放时间轴面板

如何在c#winforms中基于DateTime值制作动态缩放时间轴面板,c#,winforms,datetime,zooming,timeline,C#,Winforms,Datetime,Zooming,Timeline,我已经制作了一个面板,上面有静态日期时间范围,我想继续使用动态改变范围时间的缩放功能 我试着在互联网上四处看看,但是刚刚发现了关于缩放面板的问题(没有DateTime的动态范围值) 有人知道如何在C#winforms中实现这一点吗?或者,如果有人知道关于它的任何参考资料,那就太好了 我只是想说得更清楚一点,下面是一个例子: 这是我当前的时间线面板,间隔为20秒: 例如,如果我以04:21:30和04:21:50的时间间隔缩放,时间间隔应该更小(例如2秒)。由于有人投票赞成我的问题,我将给出我的

我已经制作了一个面板,上面有静态日期时间范围,我想继续使用动态改变范围时间的缩放功能

我试着在互联网上四处看看,但是刚刚发现了关于缩放面板的问题(没有DateTime的动态范围值)

有人知道如何在C#winforms中实现这一点吗?或者,如果有人知道关于它的任何参考资料,那就太好了

我只是想说得更清楚一点,下面是一个例子: 这是我当前的时间线面板,间隔为20秒:


例如,如果我以04:21:30和04:21:50的时间间隔缩放,时间间隔应该更小(例如2秒)。

由于有人投票赞成我的问题,我将给出我的案例的答案。 最后,我使用了和事件。通过这些事件,我可以计算像素的比例和日期时间

以下是我的代码的简化版本:

int PressedCoordinate;
int ReleasedCoordinate;

private void Mouse_Down(object sender, MouseEventArgs e)
{
    if (e.Button == MouseButtons.Left)
    {
        int PressedCoordinate = e.X;
        //in this part, calculate the DateTime based on the scale of pixel vs datetime
    }
}

private void Mouse_Up(object sender, MouseEventArgs e)
{
    if (e.Button == MouseButtons.Left)
    {
        int ReleasedCoordinate = e.X;
        //in this part, calculate the DateTime based on the scale of pixel vs datetime
        //calculate the range and do the zoom-in logic
    }
}

如果你想讨论它的细节,不要犹豫发表评论。干杯

既然有人投票赞成我的问题,我会给出我的答案。 最后,我使用了和事件。通过这些事件,我可以计算像素的比例和日期时间

以下是我的代码的简化版本:

int PressedCoordinate;
int ReleasedCoordinate;

private void Mouse_Down(object sender, MouseEventArgs e)
{
    if (e.Button == MouseButtons.Left)
    {
        int PressedCoordinate = e.X;
        //in this part, calculate the DateTime based on the scale of pixel vs datetime
    }
}

private void Mouse_Up(object sender, MouseEventArgs e)
{
    if (e.Button == MouseButtons.Left)
    {
        int ReleasedCoordinate = e.X;
        //in this part, calculate the DateTime based on the scale of pixel vs datetime
        //calculate the range and do the zoom-in logic
    }
}
如果你想讨论它的细节,不要犹豫发表评论。干杯