protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
{
if (Bars == null || ChartControl == null)
return;
base.OnRender(chartControl, chartScale);
// Get the render target for the chart
//SharpDX.Direct2D1.RenderTarget RenderTarget = chartControl.CreateRenderTarget();
// Set the font size and style for the table
RenderTarget.AntialiasMode = SharpDX.Direct2D1.AntialiasMode.PerPrimitive;
RenderTarget.TextAntialiasMode = SharpDX.Direct2D1.TextAntialiasMode.Aliased;
SharpDX.DirectWrite.Factory dwFactory = new SharpDX.DirectWrite.Factory();
TextFormat textFormat = new TextFormat(dwFactory, "Arial", 8f);
// Set the cell width and height for the table
float cellWidth = 30f;
float cellHeight = 10f;
// Set the starting position for the table
float x = 10f;
float y = 10f;
// Draw the table header
RenderTarget.DrawText("Column 1", textFormat, new RectangleF(x, y, cellWidth, cellHeight), Brushes.Red.ToDxBrush(RenderTarget), DrawTextOptions.NoSnap, MeasuringMode.GdiClassic);
x += cellWidth;
RenderTarget.DrawText("Column 2", textFormat, new RectangleF(x, y, cellWidth, cellHeight), Brushes.Red.ToDxBrush(RenderTarget), DrawTextOptions.NoSnap, MeasuringMode.GdiClassic);
x += cellWidth;
RenderTarget.DrawText("Column 3", textFormat, new RectangleF(x, y, cellWidth, cellHeight), Brushes.Red.ToDxBrush(RenderTarget), DrawTextOptions.NoSnap, MeasuringMode.GdiClassic);
x += cellWidth;
RenderTarget.DrawText("Column 4", textFormat, new RectangleF(x, y, cellWidth, cellHeight), Brushes.Red.ToDxBrush(RenderTarget), DrawTextOptions.NoSnap, MeasuringMode.GdiClassic);
x += cellWidth;
RenderTarget.DrawText("Column 5", textFormat, new RectangleF(x, y, cellWidth, cellHeight), Brushes.Red.ToDxBrush(RenderTarget), DrawTextOptions.NoSnap, MeasuringMode.GdiClassic);
y += cellHeight;
// Draw the table rows
SharpDX.Direct2D1.Brush myBrush = new SharpDX.Direct2D1.SolidColorBrush(RenderTarget, new Color4(0.9f, 0.9f, 0.9f, 1.0f)); // light gray
for (int i = 1; i <= 21; i++)
{
x = 10f;
RenderTarget.FillRectangle(new RectangleF(x, y, cellWidth, cellHeight), myBrush);
RenderTarget.DrawText("R" + i.ToString() + "C1", textFormat, new RectangleF(x, y, cellWidth, cellHeight), Brushes.Red.ToDxBrush(RenderTarget), DrawTextOptions.NoSnap, MeasuringMode.GdiClassic);
x += cellWidth;
RenderTarget.DrawText("R" + i.ToString() + "C2", textFormat, new RectangleF(x, y, cellWidth, cellHeight), Brushes.Red.ToDxBrush(RenderTarget), DrawTextOptions.NoSnap, MeasuringMode.GdiClassic);
x += cellWidth;
RenderTarget.DrawText("R" + i.ToString() + "C3", textFormat, new RectangleF(x, y, cellWidth, cellHeight), Brushes.Red.ToDxBrush(RenderTarget), DrawTextOptions.NoSnap, MeasuringMode.GdiClassic);
x += cellWidth;
RenderTarget.DrawText("R" + i.ToString() + "C4", textFormat, new RectangleF(x, y, cellWidth, cellHeight), Brushes.Red.ToDxBrush(RenderTarget), DrawTextOptions.NoSnap, MeasuringMode.GdiClassic);
x += cellWidth;
RenderTarget.DrawText("R" + i.ToString() + "C5", textFormat, new RectangleF(x, y, cellWidth, cellHeight), Brushes.Red.ToDxBrush(RenderTarget), DrawTextOptions.NoSnap, MeasuringMode.GdiClassic);
y += cellHeight;
}
myBrush.Dispose();
// Dispose of resources
textFormat.Dispose();
dwFactory.Dispose();
//RenderTarget.Dispose();
}
but it draws the table in the top left of the whole chart, so I have to pull my subwindow up in order to see the table, I want the table to be fixed to the subwindow, so if I increase the size of the subwindow, it will follow the subwindow
of course by subwindow I mean IsOverlay=false;

Comment