public override void GenerateXmlAttributes(System.Xml.XmlWriter writer)
        {
            base.GenerateXmlAttributes(writer);

            if (ShowLabel.HasValue)
            {
                writer.WriteAttributeString("showLabel", ShowLabel.GetHashCode().ToString());
            }
            if (ToolText.IsNotWhiteSpace())
            {
                writer.WriteAttributeString("toolText", ToolText);
            }
            if (Label.IsNotWhiteSpace())
            {
                writer.WriteAttributeString("label", Label);
            }

            if (ShowLabelBorder.HasValue)
            {
                writer.WriteAttributeString("showLabelBorder", ShowLabelBorder.GetHashCode().ToString());
            }

            if (LabelPosition.HasValue)
            {
                writer.WriteAttributeString("LabelPosition", LabelPosition.GetHashCode().ToString());
            }
            if (LabelHAlign.HasValue)
            {
                writer.WriteAttributeString("LabelHAlign", LabelHAlign.GetHashCode().ToString());
            }
            if (LabelVAlign.HasValue)
            {
                writer.WriteAttributeString("LabelVAlign", LabelVAlign.GetHashCode().ToString());
            }
        }
示例#2
0
        // Calculate coordinates for label around vertex
        private void FindLabelPlace(ref PointF location, int vertexRadius, LabelPosition labelPosition, SizeF labelSize)
        {
            switch (labelPosition)
            {
            case LabelPosition.Top:
                location.X -= labelSize.Width / 2;
                location.Y -= vertexRadius + (int)labelSize.Height;
                break;

            case LabelPosition.Bottom:
                location.X -= labelSize.Width / 2;
                location.Y += vertexRadius + 1;
                break;

            case LabelPosition.Left:
                location.X -= labelSize.Width + vertexRadius + 3;
                location.Y -= labelSize.Height / 2;
                break;

            case LabelPosition.Right:
                location.X += vertexRadius + 2;
                location.Y -= labelSize.Height / 2;
                break;

            case LabelPosition.Center:
                location.X -= labelSize.Width / 2;
                location.Y -= labelSize.Height / 2;
                break;
            }
        }
示例#3
0
        // set label position relatively to anchor point
        static void SetPosition(LabelState label, LabelPosition position)
        {
            if (!label.IsMovable)
            {
                return;
            }

            var sz = label.Size;

            switch (position)
            {
            case LabelPosition.TopLeft:
                label.Position = label.Point;
                break;

            case LabelPosition.TopRight:
                label.Position = new Point(label.Point.X - sz.Width, label.Point.Y);
                break;

            case LabelPosition.BottomLeft:
                label.Position = new Point(label.Point.X, label.Point.Y - sz.Height);
                break;

            case LabelPosition.BottomRight:
                label.Position = new Point(label.Point.X - sz.Width, label.Point.Y - sz.Height);
                break;
            }
        }
 private void ConfigureLabelPosition()
 {
     if (LabelPosition != HorizontalPosition.None)
     {
         ElementClass = $"{ElementClass} {LabelPosition.GetDescription()} labeled";
     }
 }
示例#5
0
 protected FormElement(string type, string name, LabelPosition labelPosition, string label)
 {
     Name          = name;
     Type          = type;
     LabelPosition = labelPosition;
     Label         = label;
 }
示例#6
0
 public wLabel(LabelPosition NewPosition, LabelAlignment NewAlignment, wGraphic NewGraphic)
 {
     Enabled   = true;
     Position  = NewPosition;
     Alignment = NewAlignment;
     Graphics  = NewGraphic;
 }
示例#7
0
        /// <summary>
        /// 속성들을 Xml Attribute로 생성합니다.
        /// </summary>
        /// <param name="writer">Attribute를 쓸 Writer</param>
        public override void GenerateXmlAttributes(XmlWriter writer)
        {
            base.GenerateXmlAttributes(writer);

            if (Dashed.HasValue)
            {
                writer.WriteAttributeString("dashed", Dashed.GetHashCode().ToString());
            }
            if (Label.IsNotWhiteSpace())
            {
                writer.WriteAttributeString("label", Label);
            }
            if (ShowLabelBorder.HasValue)
            {
                writer.WriteAttributeString("showLabelBorder", ShowLabelBorder.GetHashCode().ToString());
            }

            if (LinePosition.HasValue)
            {
                writer.WriteAttributeString("linePosition", LinePosition.ToString());
            }
            if (LabelPosition.HasValue)
            {
                writer.WriteAttributeString("labelPosition", LabelPosition.GetHashCode().ToString());
            }
            if (LabelHAlign.HasValue)
            {
                writer.WriteAttributeString("labelHAlign", LabelHAlign.GetHashCode().ToString());
            }
            if (LabelVAlign.HasValue)
            {
                writer.WriteAttributeString("labelVAlign", LabelVAlign.GetHashCode().ToString());
            }
        }
示例#8
0
 public TextField(string name, LabelPosition labelPosition, string label,
                  IEnumerable <ValidationRule <TextField> > rules, string defaultContent) : base(nameof(TextField), name,
                                                                                                 labelPosition, label)
 {
     DefaultContent = defaultContent;
     _content       = defaultContent;
     Rules          = rules;
 }
示例#9
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="labelPosition"></param>
 /// <returns></returns>
 public decimal MatchNormalizedLabelMax(LabelPosition labelPosition)
 {
     if (labelPosition != LabelPosition.Below)
     {
         return(NormalizedValue + LabelHeight);
     }
     return(NormalizedValue);
 }
示例#10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="labelPosition"></param>
 /// <returns></returns>
 public decimal MatchNormalizedLabelMin(LabelPosition labelPosition)
 {
     if (labelPosition != LabelPosition.Above)
     {
         return(NormalizedValue - LabelHeight);
     }
     return(NormalizedValue);
 }
示例#11
0
 public int AddLabel(string text, Color color, LabelPosition position, Font font)
 {
     labelId++;
     labels.Add(new CharacterLabel(text, color, position, font, labelId));
     animateTimer.Enabled = true;
     Invalidate();
     return labelId;
 }
示例#12
0
 public ComboBoxField(string name, LabelPosition labelPosition, string label,
                      IEnumerable <ValidationRule <ComboBoxField> > rules, IEnumerable <string> items, string defaultSelectedItem) :
     base(nameof(ComboBoxField), name, labelPosition, label)
 {
     DefaultSelectedItem = defaultSelectedItem;
     SelectedItem        = defaultSelectedItem;
     Items = items;
     Rules = rules;
 }
示例#13
0
 public CheckBoxField(string name, LabelPosition labelPosition, string label,
                      IEnumerable <ValidationRule <CheckBoxField> > rules, string content, bool defaultIsChecked) : base(
         nameof(CheckBoxField), name,
         labelPosition, label)
 {
     Content          = content;
     DefaultIsChecked = defaultIsChecked;
     IsChecked        = defaultIsChecked;
     Rules            = rules;
 }
示例#14
0
        // Calculate coordinates for label
        private PointF CalculateLabelPosition(PointF vertexLocation, int vertexRadius, string label, Font font,
                                              LabelPosition labelPosition = LabelPosition.Top)
        {
            PointF labelLocation = new PointF(vertexLocation.X, vertexLocation.Y);
            SizeF  labelSize     = LabelSize(label, font);

            FindLabelPlace(ref labelLocation, vertexRadius, labelPosition, labelSize);

            return(labelLocation);
        }
示例#15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Barcode" /> class.
        /// </summary>
        /// <param name="data">The data to encode as a barcode.</param>
        /// <param name="showLabel">if set to <c>true</c> show the data as a label. Defaults to false.</param>
        /// <param name="width">The width in pixels. Defaults to 300.</param>
        /// <param name="height">The height in pixels. Defaults to 150.</param>
        /// <param name="labelPosition">The label position. Defaults to bottom-center.</param>
        public Barcode(string data, bool showLabel, int width, int height, LabelPosition labelPosition)
        {
            _autoSize      = false;
            _data          = data;
            _showLabel     = showLabel;
            _width         = width;
            _height        = height;
            _labelPosition = labelPosition;

            InitializeType();
        }
示例#16
0
        private void SetLabelCompass()
        {
            var chartLabel = BubbleChart1.ChartLabel;

            chartLabel.Visible = CbVisible.Checked;
            LabelPosition labelPosition = (LabelPosition)Enum.Parse(typeof(LabelPosition), DdlPosition.SelectedValue);

            chartLabel.Position = labelPosition;
            ChartCompass compass = (ChartCompass)Enum.Parse(typeof(ChartCompass), DdlCompass.SelectedValue);

            chartLabel.Compass = compass;
        }
        /// <summary>
        ///     Устанавливает позиция «лычки» значения в зависимости от <see cref="LabelPosition"/>
        /// </summary>
        /// <param name="dataItem">Исходный <see cref="IChartDataItem"/></param>
        /// <param name="labelPosition">Указание позиции «лычки»</param>
        /// <returns>Замыкание на переданный <see cref="IChartDataItem"/></returns>
        public static IChartDataItem SetLabelPosition(this IChartDataItem dataItem, LabelPosition labelPosition)
        {
            if (labelPosition == LabelPosition.Hidden)
            {
                dataItem.SetShowValue(false);
            }
            else
            {
                dataItem.Set <ChartSet>(FusionChartApi.Chart_ValuePosition, labelPosition.ToString());
            }

            return(dataItem);
        }
示例#18
0
        public AdvancedField(string label, T @default, LabelPosition position = LabelPosition.Left, int minFieldWidth = 120, VisualElement prependLabel = null, VisualElement appendLabel = null, Action <TFieldElement, T> onValueChanged = null)
        {
            labelContainer = new VisualElement();
            labelContainer.style.position      = Position.Relative;
            labelContainer.style.flexDirection = FlexDirection.Row;
            labelContainer.style.height        = fontSize;
            labelContainer.style.marginTop     = 4;
            labelContainer.style.paddingRight  = 4;

            this.label = new Label(label);
            this.label.style.fontSize      = fontSize;
            this.label.style.position      = Position.Relative;
            this.label.style.flexDirection = FlexDirection.Row;

            labelContainer.Add(this.label);

            this.prependLabel = prependLabel;
            this.appendLabel  = appendLabel;
            this.position     = position;

            this.StretchToParentWidth();
            style.position       = Position.Relative;
            style.unityTextAlign = TextAnchor.MiddleCenter;
            style.flexDirection  = (position == LabelPosition.Left || position == LabelPosition.Right) ? FlexDirection.Row : FlexDirection.Column;

            field = System.Activator.CreateInstance(typeof(TFieldElement), @default) as TFieldElement;
            field.style.position      = Position.Relative;
            field.style.flexDirection = FlexDirection.Row;
            field.style.height        = fontSize + 8;
            field.style.minWidth      = minFieldWidth;

            field.RegisterValueChangedCallback((e) =>
            {
                onValueChanged?.DynamicInvoke(field, e.newValue);
            });

            if (position == LabelPosition.Left || position == LabelPosition.Top)
            {
                if (position == LabelPosition.Top)
                {
                    this.field.style.marginTop = this.field.style.marginTop.value.value + 8;
                }
                Add(labelContainer);
                Add(field);
            }
            else
            {
                Add(field);
                Add(labelContainer);
            }
        }
 	public DBWebAggregateControl() : base()
    {
    	FTextBox = new TextBox();
       FTextBox.ReadOnly = true;
       FLabel = new Label();
       FPanel = new System.Web.UI.WebControls.Panel();
    	FTextBoxPortion = defaultTextBoxPortion;
       FLabelPosition = LabelPosition.LabelToLeft;
       FColumnLink = new DBWebColumnLink(this);
       IColumnLink = (FColumnLink as IDBWebColumnLink);
       base.Width = new Unit(minWidth);
       // TODO: remove from object inspector
       FAggregateType = AggType.aggAvg;
    }
示例#20
0
 public DBWebAggregateControl() : base()
 {
     FTextBox          = new TextBox();
     FTextBox.ReadOnly = true;
     FLabel            = new Label();
     FPanel            = new System.Web.UI.WebControls.Panel();
     FTextBoxPortion   = defaultTextBoxPortion;
     FLabelPosition    = LabelPosition.LabelToLeft;
     FColumnLink       = new DBWebColumnLink(this);
     IColumnLink       = (FColumnLink as IDBWebColumnLink);
     base.Width        = new Unit(minWidth);
     // TODO: remove from object inspector
     FAggregateType = AggType.aggAvg;
 }
示例#21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Barcode" /> class.
        /// </summary>
        /// <param name="data">The data to encode as a barcode.</param>
        /// <param name="showLabel">if set to <c>true</c> show the data as a label. Defaults to false.</param>
        /// <param name="width">The width in pixels. Defaults to 300.</param>
        /// <param name="height">The height in pixels. Defaults to 150.</param>
        /// <param name="labelPosition">The label position. Defaults to bottom-center.</param>
        /// <param name="alignmentPosition">The alignment position. Defaults to center.</param>
        /// <param name="labelFont">The label font. Defaults to Font("Microsoft Sans Serif", 10, FontStyle.Bold)</param>
        public Barcode(string data, bool showLabel, int width, int height, LabelPosition labelPosition,
                       AlignmentPosition alignmentPosition, Font labelFont)
        {
            _autoSize          = false;
            _data              = data;
            _showLabel         = showLabel;
            _width             = width;
            _height            = height;
            _labelPosition     = labelPosition;
            _alignmentPosition = alignmentPosition;
            _labelFont         = labelFont;

            InitializeType();
        }
示例#22
0
        public Barcode(string data, bool showLabel, int width, int height, LabelPosition labelPosition, AlignmentPosition alignmentPosition, Color backgroundColor, Color foregroundColor)
        {
            _autoSize          = false;
            _data              = data;
            _showLabel         = showLabel;
            _width             = width;
            _height            = height;
            _labelPosition     = labelPosition;
            _alignmentPosition = alignmentPosition;
            _backgroundColor   = backgroundColor;
            _foregroundColor   = foregroundColor;

            InitializeType();
        }
示例#23
0
    ///<summary>
    /// Update labels
    ///</summary>
    private void UpdateLabels()
    {
        for (int i = 0; i < dataSet.Columns; i++)
        {
            labels[i].gameObject.SetActive(labelToggle.isOn);

            LabelPosition labelPosition = pieChart.GetLabelPosition(i, labelPos.value);
            if (labelPosition != null)
            {
                labels[i].rectTransform.anchoredPosition = labelPosition.position;
                labels[i].text = labelPosition.value.ToString("0.00");
            }
        }
        labelPos.interactable = labelToggle.isOn;
    }
示例#24
0
        public void SpinButtonShouldHaveLabelPositionClassName(Visual visual, LabelPosition labelPosition)
        {
            var component = RenderComponent <BitSpinButtonTest>(parameters =>
            {
                parameters.Add(p => p.Visual, visual);
                parameters.Add(p => p.LabelPosition, labelPosition);
            });

            var labelPositionClass = labelPosition == LabelPosition.Left ? "left" : "top";
            var visualClass        = visual == Visual.Cupertino ? "cupertino" : visual == Visual.Material ? "material" : "fluent";

            var container     = component.Find(".bit-spb");
            var hasLabelClass = container.ClassList.Contains($"bit-spb-label-{labelPositionClass}-{visualClass}");

            Assert.IsTrue(hasLabelClass);
        }
示例#25
0
        public LabelValidator(string aminoAcids, LabelPosition position)
        {
            switch (position)
            {
            case LabelPosition.NTERM:
                validator = new LabelNTermValidator(aminoAcids);
                break;

            case LabelPosition.CTERM:
                validator = new LabelCTermValidator(aminoAcids);
                break;

            default:
                validator = new LabelAllValidator(aminoAcids);
                break;
            }
        }
示例#26
0
        public static IEnumerable <LabelPosition[]> GetVariants(DataItem[] dataItems)
        {
            var values = new List <string>();
            var v      = dataItems.Length;

            for (var ch = 'a'; ch <= 'c'; ch++)
            {
                values.Add(ch.ToString(CultureInfo.InvariantCulture));
            }

            for (var i = 1; i < v; i++)
            {
                var newValues = new List <string>();
                EnumerableExtensions.DoForEach(values, _ => { for (var ch = 'a'; ch <= 'c'; ch++)
                                                              {
                                                                  newValues.Add(_ + ch);
                                                              }
                                               });
                values = newValues;
            }

            var indexes = GetHiddenIndexes(dataItems).ToList();

            foreach (var el in values)
            {
                var c = new LabelPosition[v];
                var k = 0;
                foreach (var ch in el.ToCharArray())
                {
                    switch (ch)
                    {
                    case 'a': c[k] = LabelPosition.Auto; break;

                    case 'b': c[k] = LabelPosition.Above; break;

                    case 'c': c[k] = LabelPosition.Below; break;
                    }
                    k++;
                }
                indexes.ForEach(_ => c[_] = LabelPosition.Hidden);
                yield return(c);
            }
        }
示例#27
0
        private Vector2 GetPaddingVector(LabelPosition position)
        {
            switch (position)
            {
            case LabelPosition.TopRight:
                return(new Vector2(_resolution.X - 20f, 20f));

            case LabelPosition.BottomRight:
                return(new Vector2(-20f, -20f));

            case LabelPosition.BottomLeft:
                return(new Vector2(-20f, 20f));

            case LabelPosition.TopLeft:
                return(new Vector2(20f, 20f));

            default:
                return(new Vector2(20f, 20f));
            }
        }
示例#28
0
 public CharacterLabel(string text, Color color, LabelPosition labelPosition, Font font, int id)
 {
     Text = text;
     Color = color;
     LabelPosition = labelPosition;
     Font = font;
     Id = id;
     if (labelPosition == LabelPosition.TOP_RIGHT_ANIMATE)
     {
         Position = TOP_RIGHT_ANIMATE_POSITION;
     }
 }
示例#29
0
        /// <summary>
        /// Draws the label flat.
        /// </summary>
        /// <param name="context">Context.</param>
        /// <param name="bordertype">Bordertype.</param>
        /// <param name="labelposition">Labelposition.</param>
        /// <param name="pin">Pin.</param>
        /// <param name="xpos">Xpos.</param>
        /// <param name="ypos">Ypos.</param>
        private static void DrawLabelFlat(Cairo.Context context, BorderType bordertype, LabelPosition labelposition, IPin pin, int xpos = 0, int ypos = 0)
        {
            string displaytext = "";
            var color = GdkToCairo (pin.PlotColor);

            displaytext = pin.DisplayNumberShort + " " + pin.Name;

            if (displaytext.Length > 12) {
                displaytext = displaytext.Substring (0, 12);
                displaytext += "...";
            }

            if (bordertype == BorderType.Line) {
                DrawRoundedRectangle (context, xpos, ypos, LabelWidth - LabelBorderWeight, FlatHeight, 5);
                context.SetSourceRGBA (color.R, color.G, color.B, color.A);
                context.LineWidth = LabelBorderWeight;
                context.Stroke ();
            }

            //PinToLabelLine
            int xposlabelline = 0;
            int yposlabelline = 0;
            switch (labelposition) {
            case LabelPosition.Left:
                xposlabelline = xpos + LabelWidth;
                yposlabelline = ypos + (FlatHeight / 2);
                break;
            case LabelPosition.Right:
                xposlabelline = xpos;
                yposlabelline = ypos + (FlatHeight / 2);
                break;
            case LabelPosition.Bottom:
                xpos = xpos + LabelWidth / 2;
                yposlabelline = ypos;
                break;
            default:
                break;
            }

            if (PinLocations.ContainsKey ((int)pin.RealNumber)) {
                DrawLines (
                    context,
                    xposlabelline,
                    yposlabelline,
                    (int)(MCUImageXZero + PinLocations [(int)pin.RealNumber].x),
                    (int)(MCUImageYZero + PinLocations [(int)pin.RealNumber].y),
                    color
                );
            }

            //Number
            context.SetSourceRGB (0, 0, 0);
            context.SelectFontFace ("Sans", FontSlant.Normal, FontWeight.Bold);
            context.SetFontSize (LabelFontSize);
            context.MoveTo (xpos + 5, ypos + LabelFontSize + LabelBorderWeight);
            context.ShowText (displaytext);
        }
示例#30
0
 public GraphicBoxGenerator At(int x, int y)
 {
     _position = new LabelPosition(x, y);
     return this;
 }
示例#31
0
 public CustomFloatField(string label, float @default, LabelPosition position = LabelPosition.Left, int minFieldWidth = 120, VisualElement prependLabel = null, VisualElement appendLabel = null, Action <FloatField, float> onValueChanged = null) : base(label, @default, position, minFieldWidth, prependLabel, appendLabel, onValueChanged)
 {
 }
示例#32
0
 public int Generate(string expression, LabelPosition position, bool largestPartOnly = true)
 {
     return(_labels.Generate(expression, (tkLabelPositioning)position, largestPartOnly));
 }
示例#33
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="labelPosition"></param>
 /// <returns></returns>
 public decimal MatchNormalizedLabelMin(LabelPosition labelPosition) {
     if (labelPosition != LabelPosition.Above) return NormalizedValue - LabelHeight;
     return NormalizedValue;
 }
示例#34
0
        protected GameObject CreateLabelWidget(string text, GameObject parent, LabelPosition position)
        {
            GameObject    widget    = new GameObject("TextElement");
            RectTransform transform = widget.AddComponent <RectTransform>();
            Text          textItem  = widget.AddComponent <Text>();

            textItem.font     = Font.CreateDynamicFontFromOSFont("Arial", 40);
            textItem.fontSize = 40;
            textItem.text     = text;

            transform.SetParent(parent.transform, false);

            switch (position)
            {
            case LabelPosition.XLower:
                textItem.alignment  = TextAnchor.UpperLeft;
                transform.pivot     = new Vector2(0f, 1f);
                transform.anchorMin = new Vector2(0f, 0f);
                transform.anchorMax = new Vector2(0f, 0f);
                transform.offsetMin = new Vector2(0f, -70f);
                transform.offsetMax = new Vector2(150f, -20f);
                break;

            case LabelPosition.XUpper:
                textItem.alignment  = TextAnchor.UpperRight;
                transform.pivot     = new Vector2(1f, 1f);
                transform.anchorMin = new Vector2(1f, 0f);
                transform.anchorMax = new Vector2(1f, 0f);
                transform.offsetMin = new Vector2(-150f, -70f);
                transform.offsetMax = new Vector2(0f, -20f);
                break;

            case LabelPosition.YLower:
                textItem.alignment  = TextAnchor.LowerRight;
                transform.pivot     = new Vector2(1f, 0f);
                transform.anchorMin = new Vector2(0f, 0f);
                transform.anchorMax = new Vector2(0f, 0f);
                transform.offsetMin = new Vector2(-170f, 0f);
                transform.offsetMax = new Vector2(-20f, 50f);
                break;

            case LabelPosition.YUpper:
                textItem.alignment  = TextAnchor.UpperRight;
                transform.pivot     = new Vector2(1f, 1f);
                transform.anchorMin = new Vector2(0f, 1f);
                transform.anchorMax = new Vector2(0f, 1f);
                transform.offsetMin = new Vector2(-170f, -50f);
                transform.offsetMax = new Vector2(-20f, 0f);
                break;

            default:
                Debug.LogError($"Unexpected position: {position}");
                break;
            }

            //ThemeText themeText = widget.AddComponent<ThemeText>();
            //themeText.textType = ThemeText.ThemeTextType.SystemText;
            //themeText.FindTier();
            //themeText.UpdateFormatting();

            return(widget);
        }
示例#35
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="labelPosition"></param>
 /// <returns></returns>
 public decimal MatchNormalizedLabelMax(LabelPosition labelPosition) {
     if (labelPosition != LabelPosition.Below) return NormalizedValue + LabelHeight;
     return NormalizedValue;
 }
示例#36
0
 public bool Generate(LabelPosition position)
 {
     return(_charts.Generate((tkLabelPositioning)position));
 }
示例#37
0
 /// <summary>
 /// Draws the label.
 /// </summary>
 /// <param name="context">Context.</param>
 /// <param name="format">Format.</param>
 /// <param name="bordertype">Bordertype.</param>
 /// <param name="labelposition">Labelposition.</param>
 /// <param name="pin">Pin.</param>
 /// <param name="xpos">Xpos.</param>
 /// <param name="ypos">Ypos.</param>
 public static void DrawLabel(Cairo.Context context, LabelFormat format, BorderType bordertype, LabelPosition labelposition, IPin pin, int xpos, int ypos)
 {
     switch (format) {
     case LabelFormat.Flat:
         DrawLabelFlat (context, bordertype, labelposition, pin, xpos, ypos);
         break;
     case LabelFormat.Bold:
         DrawLabel (context, bordertype, pin, xpos, ypos);
         break;
     }
 }
示例#38
0
        /// <summary>
        ///	Draws the labels. 
        /// </summary>
        /// <param name="context">Context.</param>
        /// <param name="pins">Pins.</param>
        /// <param name="xpos">Xpos.</param>
        /// <param name="ypos">Ypos.</param>
        /// <param name="labelposition">Labelposition.</param>
        /// <param name="labelformat">Labelformat.</param>
        /// <param name="bordtype">Bordtype.</param>
        public static void SetPinLabels(Cairo.Context context, List<IPin> pins, int xpos, int ypos, LabelPosition labelposition, LabelFormat labelformat = LabelFormat.Flat, BorderType bordtype = BorderType.Line)
        {
            int height = (labelformat == LabelFormat.Flat) ? FlatHeight : BoldHeight;

            for (int i = 0; i < pins.Count; i++) {
                DrawLabel (context, labelformat, bordtype, labelposition, pins [i], xpos, ypos + (i * height + i * Space));
            }
        }
示例#39
0
 public GraphicBoxGenerator At(int x, int y)
 {
     _position = new LabelPosition(x, y);
     return(this);
 }
示例#40
0
        // set label position relatively to anchor point
        static void SetPosition(LabelState label, LabelPosition position)
        {
            if (!label.IsMovable)
            return;

              var sz = label.Size;

              switch (position)
              {
            case LabelPosition.TopLeft:
              label.Position = label.Point;
              break;
            case LabelPosition.TopRight:
              label.Position = new Point(label.Point.X - sz.Width, label.Point.Y);
              break;
            case LabelPosition.BottomLeft:
              label.Position = new Point(label.Point.X, label.Point.Y - sz.Height);
              break;
            case LabelPosition.BottomRight:
              label.Position = new Point(label.Point.X - sz.Width, label.Point.Y - sz.Height);
              break;
              }
        }