C# 点值持续闪烁(IsShowPointValues)
我制作了一个图表,每当我在任何点上移动光标时,它都会显示值。我使用zedGraphControl1.IsShowPointValues=true代码> 问题是从中显示的工具提示正在闪烁。在互联网上四处搜索后,我发现了以下论坛帖子: 有人知道如何使用这个补丁吗?C# 点值持续闪烁(IsShowPointValues),c#,graph,patch,zedgraph,C#,Graph,Patch,Zedgraph,我制作了一个图表,每当我在任何点上移动光标时,它都会显示值。我使用zedGraphControl1.IsShowPointValues=true 问题是从中显示的工具提示正在闪烁。在互联网上四处搜索后,我发现了以下论坛帖子: 有人知道如何使用这个补丁吗? 或者还有其他解决方案吗?该修补程序是一个文本文件,两个版本的差异文件,您可以添加文件扩展名为Tooltip\u Flicker.patch.cs您可以使用texteditor(例如Notepad++,Visual studio)打开它 因此,
或者还有其他解决方案吗?该修补程序是一个文本文件,两个版本的差异文件,您可以添加文件扩展名为
Tooltip\u Flicker.patch.cs
您可以使用texteditor(例如Notepad++,Visual studio)打开它
因此,您需要下载源代码,并将该文件修改为补丁文件,然后重建它。祝您好运
内容如下:
Index: source/ZedGraph/ZedGraphControl.Events.cs
===================================================================
--- source/ZedGraph/ZedGraphControl.Events.cs (revision 451)
+++ source/ZedGraph/ZedGraphControl.Events.cs (working copy)
@@ -713,15 +713,19 @@
{
if ( nearestObj is CurveItem && iPt >= 0 )
{
- CurveItem curve = (CurveItem)nearestObj;
+ CurveItem curve = (CurveItem)nearestObj;
+ string label = "";
// Provide Callback for User to customize the tooltips
if ( this.PointValueEvent != null )
{
- string label = this.PointValueEvent( this, pane, curve, iPt );
+ label = this.PointValueEvent( this, pane, curve, iPt );
if ( label != null && label.Length > 0 )
- {
- this.pointToolTip.SetToolTip( this, label );
- this.pointToolTip.Active = true;
+ {
+ if ( this.pointToolTip.GetToolTip( this ) != label )
+ {
+ this.pointToolTip.SetToolTip( this, label );
+ this.pointToolTip.Active = true;
+ }
}
else
this.pointToolTip.Active = false;
@@ -730,9 +734,8 @@
{
if ( curve is PieItem )
- {
- this.pointToolTip.SetToolTip( this,
- ( (PieItem)curve ).Value.ToString( _pointValueFormat ) );
+ {
+ label = ( (PieItem)curve ).Value.ToString( _pointValueFormat );
}
// else if ( curve is OHLCBarItem || curve is JapaneseCandleStickItem )
// {
@@ -750,7 +753,7 @@
PointPair pt = curve.Points[iPt];
if ( pt.Tag is string )
- this.pointToolTip.SetToolTip( this, (string)pt.Tag );
+ label = (string)pt.Tag;
else
{
double xVal, yVal, lowVal;
@@ -766,14 +769,18 @@
string yStr = MakeValueLabel( curve.GetYAxis( pane ), yVal, iPt,
curve.IsOverrideOrdinal );
- this.pointToolTip.SetToolTip( this, "( " + xStr + ", " + yStr + " )" );
+ label = string.Format( "( {0}, {1} )", xStr, yStr );
//this.pointToolTip.SetToolTip( this,
// curve.Points[iPt].ToString( this.pointValueFormat ) );
}
- }
-
- this.pointToolTip.Active = true;
+ }
+
+ if ( this.pointToolTip.GetToolTip( this ) != label )
+ {
+ this.pointToolTip.SetToolTip( this, label );
+ this.pointToolTip.Active = true;
+ }
}
}
else
@@ -791,15 +798,19 @@
{
GraphPane pane = _masterPane.FindPane( mousePt );
if ( pane != null && pane.Chart._rect.Contains( mousePt ) )
- {
+ {
+ string label = "";
// Provide Callback for User to customize the tooltips
if ( this.CursorValueEvent != null )
{
- string label = this.CursorValueEvent( this, pane, mousePt );
+ label = this.CursorValueEvent( this, pane, mousePt );
if ( label != null && label.Length > 0 )
- {
- this.pointToolTip.SetToolTip( this, label );
- this.pointToolTip.Active = true;
+ {
+ if ( this.pointToolTip.GetToolTip( this ) != label )
+ {
+ this.pointToolTip.SetToolTip( this, label );
+ this.pointToolTip.Active = true;
+ }
}
else
this.pointToolTip.Active = false;
@@ -812,8 +823,12 @@
string yStr = MakeValueLabel( pane.YAxis, y, -1, true );
string y2Str = MakeValueLabel( pane.Y2Axis, y2, -1, true );
- this.pointToolTip.SetToolTip( this, "( " + xStr + ", " + yStr + ", " + y2Str + " )" );
- this.pointToolTip.Active = true;
+ label = string.Format( "( {0}, {1}, {2} )", xStr, yStr, y2Str );
+ if ( this.pointToolTip.GetToolTip( this ) != label )
+ {
+ this.pointToolTip.SetToolTip( this, "( " + xStr + ", " + yStr + ", " + y2Str + " )" );
+ this.pointToolTip.Active = true;
+ }
}
}
else
修补程序是一个文本文件,是两个版本的差异文件,您可以添加文件扩展名为
Tooltip\u Flicker.patch.cs
您可以使用texteditor打开它(例如Notepad++,Visual studio)
因此,您需要下载源代码,并将该文件修改为补丁文件,然后重建它。祝您好运
内容如下:
Index: source/ZedGraph/ZedGraphControl.Events.cs
===================================================================
--- source/ZedGraph/ZedGraphControl.Events.cs (revision 451)
+++ source/ZedGraph/ZedGraphControl.Events.cs (working copy)
@@ -713,15 +713,19 @@
{
if ( nearestObj is CurveItem && iPt >= 0 )
{
- CurveItem curve = (CurveItem)nearestObj;
+ CurveItem curve = (CurveItem)nearestObj;
+ string label = "";
// Provide Callback for User to customize the tooltips
if ( this.PointValueEvent != null )
{
- string label = this.PointValueEvent( this, pane, curve, iPt );
+ label = this.PointValueEvent( this, pane, curve, iPt );
if ( label != null && label.Length > 0 )
- {
- this.pointToolTip.SetToolTip( this, label );
- this.pointToolTip.Active = true;
+ {
+ if ( this.pointToolTip.GetToolTip( this ) != label )
+ {
+ this.pointToolTip.SetToolTip( this, label );
+ this.pointToolTip.Active = true;
+ }
}
else
this.pointToolTip.Active = false;
@@ -730,9 +734,8 @@
{
if ( curve is PieItem )
- {
- this.pointToolTip.SetToolTip( this,
- ( (PieItem)curve ).Value.ToString( _pointValueFormat ) );
+ {
+ label = ( (PieItem)curve ).Value.ToString( _pointValueFormat );
}
// else if ( curve is OHLCBarItem || curve is JapaneseCandleStickItem )
// {
@@ -750,7 +753,7 @@
PointPair pt = curve.Points[iPt];
if ( pt.Tag is string )
- this.pointToolTip.SetToolTip( this, (string)pt.Tag );
+ label = (string)pt.Tag;
else
{
double xVal, yVal, lowVal;
@@ -766,14 +769,18 @@
string yStr = MakeValueLabel( curve.GetYAxis( pane ), yVal, iPt,
curve.IsOverrideOrdinal );
- this.pointToolTip.SetToolTip( this, "( " + xStr + ", " + yStr + " )" );
+ label = string.Format( "( {0}, {1} )", xStr, yStr );
//this.pointToolTip.SetToolTip( this,
// curve.Points[iPt].ToString( this.pointValueFormat ) );
}
- }
-
- this.pointToolTip.Active = true;
+ }
+
+ if ( this.pointToolTip.GetToolTip( this ) != label )
+ {
+ this.pointToolTip.SetToolTip( this, label );
+ this.pointToolTip.Active = true;
+ }
}
}
else
@@ -791,15 +798,19 @@
{
GraphPane pane = _masterPane.FindPane( mousePt );
if ( pane != null && pane.Chart._rect.Contains( mousePt ) )
- {
+ {
+ string label = "";
// Provide Callback for User to customize the tooltips
if ( this.CursorValueEvent != null )
{
- string label = this.CursorValueEvent( this, pane, mousePt );
+ label = this.CursorValueEvent( this, pane, mousePt );
if ( label != null && label.Length > 0 )
- {
- this.pointToolTip.SetToolTip( this, label );
- this.pointToolTip.Active = true;
+ {
+ if ( this.pointToolTip.GetToolTip( this ) != label )
+ {
+ this.pointToolTip.SetToolTip( this, label );
+ this.pointToolTip.Active = true;
+ }
}
else
this.pointToolTip.Active = false;
@@ -812,8 +823,12 @@
string yStr = MakeValueLabel( pane.YAxis, y, -1, true );
string y2Str = MakeValueLabel( pane.Y2Axis, y2, -1, true );
- this.pointToolTip.SetToolTip( this, "( " + xStr + ", " + yStr + ", " + y2Str + " )" );
- this.pointToolTip.Active = true;
+ label = string.Format( "( {0}, {1}, {2} )", xStr, yStr, y2Str );
+ if ( this.pointToolTip.GetToolTip( this ) != label )
+ {
+ this.pointToolTip.SetToolTip( this, "( " + xStr + ", " + yStr + ", " + y2Str + " )" );
+ this.pointToolTip.Active = true;
+ }
}
}
else
修复有一个缺陷。返回到同一点不会显示工具提示。为了解决这个问题,我替换了代码部分中的每个实例
this.pointToolTip.Active = false;
与
修复有一个缺陷。返回到同一点不会显示工具提示。为了解决这个问题,我替换了代码部分中的每个实例
this.pointToolTip.Active = false;
与
抱歉,我仍然不明白“将文件修改为补丁文件,然后重建它。”我已经下载了它,并像你说的那样将格式文件更改为.cs。但是当我将它插入我的项目浏览器(VisualStudio2010)并重建它时。它显示了许多错误。
+
表示添加行<代码>-表示删除该行。您需要自己修改该文件。然后重建项目。——source/ZedGraph/ZedGraphControl.Events.cs(修订版451)++source/ZedGraph/ZedGraphControl.Events.cs(工作副本)@-713,15+713,19@
这些行只是为您提供的附加信息。你可以删除它们。这意味着它已经在zedgraph中实现了,不是吗?@YusrilMaulidanRaji这是zedgraphic的一个bug。所以现在你需要自己修复这个bug。补丁ifle只是一个供你修改的参考。对不起,我仍然不理解“将文件修改为补丁文件,然后重建它。”我已经下载了它,并像你说的那样将格式文件更改为.cs。但是当我将它插入我的项目浏览器(VisualStudio2010)并重建它时。它显示了许多错误。+
表示添加行<代码>-表示删除该行。您需要自己修改该文件。然后重建项目。——source/ZedGraph/ZedGraphControl.Events.cs(修订版451)++source/ZedGraph/ZedGraphControl.Events.cs(工作副本)@-713,15+713,19@
这些行只是为您提供的附加信息。你可以删除它们。这意味着它已经在zedgraph中实现了,不是吗?@YusrilMaulidanRaji这是zedgraphic的一个bug。所以现在你需要自己修复这个bug。补丁ifle只是一个供您修复的参考。这在Nugget中提供的上一个ZedGraph版本中已经修复。@Larry,我不知道SourceForge()中的版本和Nugget()中的版本之间是否有不同的版本。下次我会试试的。谢谢你提供的信息。谢谢Larry,我从使用旧的zedgraph dll改为nuget版本,它修复了显示点值闪烁错误。这已在Nugget中可用的上一个zedgraph版本中修复。@Larry,我不知道SourceForge()中的版本和Nugget()中的版本是否不同。下次我会试试的。谢谢你提供的信息。谢谢Larry,我从使用旧的zedgraph dll改为nuget版本,它修复了显示点值闪烁的错误。