Profile Picture

Panel Positioning - MarginAreas

Posted By Kevin Harrison 14 Years Ago
Author
Message
Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Kevin,

The MarginsArea, BorderArea and ContentArea of each content panel are calculated at layout phase. This is why you cannot use them when configuring the control reliably as they indeed "lag" by one repaint. They can be used when you use custom painting only.

The following code snippet for example shows how to achieve a layout where the legend and chart top edge are aligned:

   nChartControl1.Panels.Clear();

   NLabel label = nChartControl1.Labels.AddHeader("Chart Header");
   label.Size = new NSizeL(0, 100);
   label.Margins = new NMarginsL(10, 10, 10, 0);

   label.Dock = DockStyle.Top;

   // content panel
   NDockPanel content = new NDockPanel();
   content.Margins = new NMarginsL(10, 10, 10, 10);
   content.PositionChildPanelsInContentBounds = true;
   nChartControl1.Document.RootPanel.ChildPanels.Add(content);
   content.Dock = DockStyle.Fill;

   // create legend
   NLegend legend = new NLegend();
   legend.Margins = new NMarginsL(10, 0, 0, 0);
   legend.FitAlignment = ContentAlignment.TopCenter;
   content.ChildPanels.Add(legend);
   legend.Dock = DockStyle.Right;
   
   // create chart
   NCartesianChart chart = new NCartesianChart();
   chart.Dock = DockStyle.Fill;
   content.ChildPanels.Add(chart);
   chart.DisplayOnLegend = legend;
   chart.BoundsMode = BoundsMode.Stretch;

   NPointSeries point = new NPointSeries();
   chart.Series.Add(point);

   for (int i = 0; i < 10; i++)
   {
    point.Values.Add(i);
    point.XValues.Add(i);
   }

Is this similar to the layout configuration you want?



Best Regards,
Nevron Support Team



Kevin Harrison
Posted 14 Years Ago
View Quick Profile
Forum Guru

Forum Guru (52 reputation)Forum Guru (52 reputation)Forum Guru (52 reputation)Forum Guru (52 reputation)Forum Guru (52 reputation)Forum Guru (52 reputation)Forum Guru (52 reputation)Forum Guru (52 reputation)Forum Guru (52 reputation)

Group: Forum Members
Last Active: 12 Years Ago
Posts: 52, Visits: 1

I am trying to adjust the docking margin of a top docked title, over a second panel containing a right-docked legend and a chart, which is dock fill.  What I want to do is align the title over the chart, ignoring the legend.  I am using MarginsArea of the legend panel, but this seems to lag behind by one draw.  For example, when I first draw the control, all panel MarginAreas return 0. Is this correct? Is there another property I can use to find out the actual position of the legend?





Similar Topics


Reading This Topic