Esempio n. 1
0
        private void boxTextModeCombo_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (EventsHandlingPaused)
            {
                return;
            }

            // get the selected label
            NBoundsLabel label = labelsCombo.SelectedItem as NBoundsLabel;

            if (label == null)
            {
                return;
            }

            // change the bounds label display mode
            label.Mode = (BoxTextMode)boxTextModeCombo.SelectedIndex;
            document.SmartRefreshAllViews();
        }
Esempio n. 2
0
        private void marginsButton_Click(object sender, System.EventArgs e)
        {
            // get the selected label
            NBoundsLabel label = labelsCombo.SelectedItem as NBoundsLabel;

            if (label == null)
            {
                return;
            }

            // change the bounds label margins
            Nevron.Diagram.NMargins margins = new Nevron.Diagram.NMargins();
            if (Nevron.Diagram.Editors.NMarginsTypeEditor.Edit(label.Margins, ref margins) == false)
            {
                return;
            }

            label.Margins = margins;
            document.SmartRefreshAllViews();
        }
Esempio n. 3
0
        private void InitDocument()
        {
            // create a rectangle shape with a 2 bounds label
            NShape shape = new NRectangleShape(base.GetGridCell(0, 0));

            shape.Style.FillStyle = new NColorFillStyle(Color.FromArgb(50, 0xcc, 0, 0));

            shape.Labels.RemoveAllChildren();

            NBoundsLabel boundsLabel = new NBoundsLabel("Label 1, Wrapped", shape.UniqueId, new Nevron.Diagram.NMargins(0, 0, 0, 50));

            shape.Labels.AddChild(boundsLabel);
            shape.Labels.DefaultLabelUniqueId = boundsLabel.UniqueId;

            boundsLabel      = new NBoundsLabel("Label 2, Stretched", shape.UniqueId, new Nevron.Diagram.NMargins(0, 0, 50, 0));
            boundsLabel.Mode = BoxTextMode.Stretch;
            shape.Labels.AddChild(boundsLabel);

            document.ActiveLayer.AddChild(shape);

            // create a rectangle shape with a 2 rotated bounds labels
            shape = new NRectangleShape(base.GetGridCell(0, 1));
            shape.Style.FillStyle = new NColorFillStyle(Color.FromArgb(50, 0, 0, 0xcc));

            shape.Labels.RemoveAllChildren();

            NRotatedBoundsLabel rotatedLabel = new NRotatedBoundsLabel("Rotated Label 1, Wrapped", shape.UniqueId, new Nevron.Diagram.NMargins(0, 0, 0, 50));

            shape.Labels.AddChild(rotatedLabel);
            shape.Labels.DefaultLabelUniqueId = rotatedLabel.UniqueId;

            rotatedLabel      = new NRotatedBoundsLabel("Rotated Label 2, Stretched", shape.UniqueId, new Nevron.Diagram.NMargins(0, 0, 50, 0));
            rotatedLabel.Mode = BoxTextMode.Stretch;
            shape.Labels.AddChild(rotatedLabel);

            document.ActiveLayer.AddChild(shape);

            // create a polyline shape with two logical line labels
            NRectangleF cell = base.GetGridCell(1, 0, 0, 1);

            shape = new NPolylineShape(new NPointF[] { cell.Location, cell.RightBottom });

            shape.Labels.RemoveAllChildren();

            NLogicalLineLabel lineLabel = new NLogicalLineLabel("Line label - start", shape.UniqueId, 0, true, true);

            shape.Labels.AddChild(lineLabel);
            shape.Labels.DefaultLabelUniqueId = lineLabel.UniqueId;

            // alter the start label text style
            NTextStyle textStyle = document.Style.TextStyle.Clone() as NTextStyle;

            textStyle.StringFormatStyle.HorzAlign = HorzAlign.Left;
            textStyle.Offset = new NPointL(0, -7);
            NStyle.SetTextStyle(lineLabel, textStyle);

            // add the end label
            lineLabel = new NLogicalLineLabel("Line label - end", shape.UniqueId, 100, true, true);
            shape.Labels.AddChild(lineLabel);

            // alter the end label text style
            textStyle = document.Style.TextStyle.Clone() as NTextStyle;
            textStyle.StringFormatStyle.HorzAlign = HorzAlign.Right;
            textStyle.Offset = new NPointL(0, -7);
            NStyle.SetTextStyle(lineLabel, textStyle);

            document.ActiveLayer.AddChild(shape);
        }