When the DockMode property is set to PanelDockMode.None the panel position is controlled from the Location and ContentAlignment properties. The location property is specified in NPointL format. This means that it is actually a composition of two NLengths each one of them consisting of a Value and Measurement Unit. For more information on Measurement Units please consult the Nevron Presentation Layer User's Guide. The following code will create a label and position it in the middle of the chart canvas:
C# |
Copy Code
|
---|---|
NLabel label = new NLabel("My Center Label"); label.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(50, NRelativeUnit.ParentPercentage)); label.ContentAlignment = ContentAlignment.MiddleCenter; chartControl.Panels.Add(label); |
Visual Basic |
Copy Code
|
---|---|
Dim label As New NLabel("My Center Label") label.Location = New NPointL(New NLength(50, NRelativeUnit.ParentPercentage), New NLength(50, NRelativeUnit.ParentPercentage)) label.ContentAlignment = ContentAlignment.MiddleCenter chartControl.Panels.Add(label) |
The fact that the location property is specified in NPointL format gives you great flexibility when you position panels on the canvas. Suppose you have to position the label ten pixels away from the left top corner of the canvas. In this case the code should look like:
C# |
Copy Code
|
---|---|
NLabel label = new NLabel("My Left Top Label"); label.Location = new NPointL(new NLength(10, NGraphicsUnit.Pixel), new NLength(10, NGraphicsUnit.Pixel)); label.ContentAlignment = ContentAlignment.BottomRight; chartControl.Panels.Add(label); |
Visual Basic |
Copy Code
|
---|---|
Dim label As New NLabel("My Left Top Label") label.Location = New NPointL(New NLength(10, NGraphicsUnit.Pixel), New NLength(10, NGraphicsUnit.Pixel)) label.ContentAlignment = ContentAlignment.BottomRight chartControl.Panels.Add(label) |