How to change Label Size


Author
Message
joern kunze
joern kunze
Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)
Group: Forum Members
Posts: 86, Visits: 221
Hi Experts,
I want to add to a chart a footer label to give some status information which should look like:
https://www.nevron.com/forum/uploads/images/fe49dc49-d4d7-4c2e-89fa-c5d6.bmp

Unfortunatly, I cant change the footer label's width to fit the width of the chart. The code looks as follows:
   /*----- ChartPane Footer -----*/
    //Attn: refresh in ucMain is necessary!!! => _oChartPane._PaneFooter.Refresh();
    m_ContainerPanel = new NDockPanel();
    m_ContainerPanel.Location = new NPointL(new NLength(7, NRelativeUnit.ParentPercentage), new NLength(96, NRelativeUnit.ParentPercentage));

    m_ContainerPanel.Size = new NSizeL(new NLength(100, NRelativeUnit.ParentPercentage), new NLength(5, NRelativeUnit.ParentPercentage));
    m_ContainerPanel.DockMode = PanelDockMode.Bottom;
    m_ContainerPanel.PositionChildPanelsInContentBounds = false;


    _PaneFooter = new NLabel("Info: some status information will be given here ...");
    _PaneFooter.DockMode = PanelDockMode.None;  //alternativly: using Panels.AddFooter => doesnt work...
    _PaneFooter.TextStyle.FontStyle = new NFontStyle("Arial", 10, FontStyle.Regular);
    _PaneFooter.ContentAlignment = ContentAlignment.MiddleLeft;  // BottomCenter;  //MiddleLeft;

    _PaneFooter.UseAutomaticSize = false;
    _PaneFooter.Location = new NPointL(new NLength(100, NRelativeUnit.ParentPercentage), new NLength(85, NRelativeUnit.ParentPercentage));
    _PaneFooter.Size = new NSizeL(new NLength(100, NRelativeUnit.ParentPercentage), new NLength(600, NGraphicsUnit.Pixel));

    _PaneFooter.BoundsMode = BoundsMode.None; //fit doesnt work neither
    _PaneFooter.FitMode = TitleFitMode.Clip;

    _PaneFooter.TextStyle.BackplaneStyle.Visible = true;
    _PaneFooter.TextStyle.BackplaneStyle.FillStyle = new NColorFillStyle(Color.AliceBlue); //new NGradientFillStyle(Color.LightGray, Color.LightGray);

    _PaneFooter.Text = sMainPaneFooter;

    m_ContainerPanel.ChildPanels.Add(_PaneFooter);
    _NevronChart.Panels.Add(m_ContainerPanel);

I tried various settings with and without the ContainerPanel, the method .AddFooter etc - but with no luck so far. The main problem is, that the command  _PaneFooter.Size = ...  doesnt work at all, the result always is a centered label where the borders are  fitted to the length of the text - it always looks like: 
https://www.nevron.com/forum/uploads/images/1f69e79b-6cc6-44b4-b55d-509b.bmp

Is there a way to change just the width of the label?

If there isnt a way, it would be sufficient to force the clipping mode:
_PaneFooter.FitMode = TitleFitMode.Clip;
not to clip the text at both sides left and right but just at the right side.
Is there a way to achieve this?
By the way: I cant imagine any real case where it makes sense to clip the text at left and right side - usually the most important part of the label text is at the beginning - so imho it would be much better to clip only the right part of the text.

Thanks for your help!

Best regards,
Joern
Reply
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Joern,

We would advise to use panel docking (and optionally panel borders) to have a label that completely spans the bottom part of the chart - for example:

NLabel footer = new NLabel();
footer.Text = "Footer";
footer.DockMode = PanelDockMode.Bottom;
nChartControl1.Panels.Add(footer);


NDockPanel contentPanel = new NDockPanel();
contentPanel.Margins = new NMarginsL(10, 10, 10, 10);
contentPanel.DockMode = PanelDockMode.Fill;

NLabel header = new NLabel();
header.Margins = new NMarginsL(0, 0, 0, 10);
header.Text = "Header";
header.DockMode = PanelDockMode.Top;
contentPanel.ChildPanels.Add(header);

NCartesianChart chart = new NCartesianChart();
chart.DockMode = PanelDockMode.Fill;

contentPanel.ChildPanels.Add(chart);

nChartControl1.Panels.Add(contentPanel);

You're right about the clipping - in this case it should automatically set text alignment to left.



Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search