Hi Ilia,
I see - this is kind of tricky to accompish. The idea is to dock a content panel to the chart plot area and get this panel bounds. The following code shows how to do it:
private void Form1_Load(object sender, EventArgs e)
{
NChart chart = nChartControl1.Charts[0];
NBarSeries bar = new NBarSeries();
bar.Values.Add(10);
bar.Values.Add(20);
bar.Values.Add(30);
chart.Series.Add(bar);
chart.PositionChildPanelsInContentBounds = true;
NWatermark panel = new NWatermark();
panel.FillStyle = new NColorFillStyle(Color.FromArgb(0, Color.White));
panel.StandardFrameStyle.Visible = false;
panel.Dock = DockStyle.Fill;
panel.PaintCallback = new NMyPaintCallback();
chart.ChildPanels.Add(panel);
}
class NMyPaintCallback : NPaintCallback
{
public NMyPaintCallback()
{
}
public override void OnAfterPaint(NPanel panel, NPanelPaintEventArgs eventArgs)
{
NContentPanel contentPanel = (NContentPanel)panel;
eventArgs.Graphics.PaintRectangle(
new NColorFillStyle(Color.FromArgb(35, Color.Red)),
null,
contentPanel.ContentBounds);
}
}
Are these the intended bounds?
Best regards,
Bob