Posted 15 December 2020, 5:56 am EST - Updated 3 October 2022, 2:29 pm EST
FlexChart ToolTips Color
Posted by: khoitsma on 15 December 2020, 5:56 am EST
-
-
Posted 16 December 2020, 7:15 pm EST
Hi Karl,
Thank you for sharing the code snippet and snapshot.
This is the default behavior of MS Tooltip (Winforms) as it doesn’t allow us to directly change its appearance. However, we can custom draw the tooltip in order to change its appearance by setting ToolTip’s OwnerDraw property to true and handle its Draw event as follows:
flexChart1.ToolTip.OwnerDraw = true; flexChart1.ToolTip.Draw += (s, e) => { var background = new SolidBrush(Color.Yellow); var foreground = new SolidBrush(Color.Red); var format = new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }; e.Graphics.FillRectangle(background, e.Bounds); e.DrawBorder(); e.Graphics.DrawString(e.ToolTipText, e.Font, foreground, e.Bounds, format); format.Dispose(); background.Dispose(); foreground.Dispose(); };
Please refer to the same from the attached sample. (see FlexChartTooltip.zip)
Just in case, if you want to set Html content as tooltip you may also refer to the Tooltips section of the product sample present at location Documents\ComponentOne Samples\WinForms\v4.5.2\FlexChart\CS\FlexChartExplorer\FlexChartExplorer\Samples\ChartElements
Regards,
Kartik -
Posted 16 December 2020, 7:16 pm EST