Closed paul1956 closed 1 year ago
I am afraid that this is not possible for standard tooltips :(
But you can try to use CalloutAnnotation
instead. It is highly customizable and just looks better.
What would be required to respect High Contrast Mode for ToolTips? I will look into CalloutAnnotations, I have a series of vertical bars and currently the ToolTip shows the Y value of the one hovered over.
What would be required to respect High Contrast Mode for ToolTips?
I don't even know, at least it will require to implement it inside the control, but as a maximum it is simply impossible. I'm wondering how native datagridview tooltips (for example for columns) look like in this contrast mode?
I will look into CalloutAnnotations, I have a series of vertical bars and currently the ToolTip shows the Y value of the one hovered over.
Yea CalloutAnnotations
will be good for this.
How do I control Visibility? Now when someone hovers over a line or marker the ToolTip just appears and then disappears automatically. Below is just 1 object, every line can be hovered over.
How do I control Visibility? Now when someone hovers over a line or marker the ToolTip just appears and then disappears automatically.
Your talk about ToolTip
or CalloutAnnotations
?
If second then you need to control it by yourself. Something like this:
private void chart1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button != MouseButtons.None || e.Clicks > 0 || e.Location == _prevLoc)
return;
_prevLoc = e.Location;
var results = chart1.HitTest(e.X, e.Y, true, ChartElementType.DataPoint); // your can search for any ChartElementType your need here
foreach (var result in results)
{
if (result.Series is null)
continue;
try
{
var point = result.Series.Points[result.PointIndex];
_calloutAnnotation1.AnchorDataPoint = point;
_calloutAnnotation1.LineColor = result.Series.Color;
_calloutAnnotation1.Text = point.Tag.ToString(); // it's just for example
if (!_calloutAnnotation1.Visible)
_calloutAnnotation1.Visible = true;
return;
}
catch (Exception ex)
{
// error handling here
}
}
if (_calloutAnnotation1.Visible)
_calloutAnnotation1.Visible = false;
}
// may be also
private void chart1_MouseLeave(object sender, EventArgs e)
{
if (_calloutAnnotation1.Visible)
_calloutAnnotation1.Visible = false;
}
Thanks. I already have most of that code because mousing over most objects cause additional information to display on top and images to change. I was just missing a one thing you filled in.
I believe supporting high contrast ToolTips is easy in that there is a windows Api (SystemInformation.HighContrast Property (System.Windows.Forms)) and events when theme switches that tells you the system is in high contract mode and there system.Color constants like SystemColors.WindowText and SystemColors.Window that work correctly. I will be testing DataGridView next week I think the issue there is with alternating styles. Many people using my app have vision issues due to Diabetes and I would like to make it easier on them.
Thanks for your help.
I've just checked this. As I thought, these tooltips are drawn by Windows, and they change when you turn on high contract mode:
Odd my uses are seeing them as Black on Black, but callouts are working great, so I don't care.
Is it possible to change ToolTip color and/or have tooltip color respond to HighContrastMode in Windows? The black background with black text is high contrast mode is impossible to read.