Beispiel #1
0
        public static string GetName(LabelAlign type)
        {
            string result = String.Empty;

            switch (type)
            {
                case LabelAlign.Left:
                    result = "left";
                    break;
                case LabelAlign.Right:
                    result = "right";
                    break;
                case LabelAlign.Top:
                    result = "top";
                    break;
            }

            return result;
        }
        private void DrawLabel(LabelModel labelModel, ChartPlotInfo info, LabelAlign align = LabelAlign.Left)
        {
            switch (align)
            {
                case LabelAlign.Left:
                    break;
                case LabelAlign.Center:
                    labelModel.XPix -= labelModel.Text.Length * 4;
                    break;
                case LabelAlign.Right:
                    break;
                default:
                    break;
            }

            var textBlock = new TextBlock();
            textBlock.Text = labelModel.Text;

            RenderElement(textBlock, labelModel.XPix, labelModel.YPix);
        }
Beispiel #3
0
        public LabelObject(WindowObject parent, Font font, string text, LabelAlign horizontalAlign, LabelAlign verticalAlign, bool richText = false)
            : base(parent)
        {
            m_color = 0xffffff;
            m_alpha = 1.0f;
            m_font  = font;

            float x = 1;
            float y = 1;

            switch (horizontalAlign)
            {
            case LabelAlign.Start:
                x = 0;
                break;

            case LabelAlign.Center:
                x = 0.5f;
                break;
            }
            switch (verticalAlign)
            {
            case LabelAlign.Start:
                y = 0;
                break;

            case LabelAlign.Center:
                y = 0.5f;
                break;
            }

            m_pivot = new Vector2(x, y);

            Init(text, richText);
        }
Beispiel #4
0
 /// <summary>
 /// create a label for rendering
 /// </summary>
 public ILWorldLabel (ILPanel panel) 
     : base(panel,new Font(FontFamily.GenericSansSerif,10.0f)
             ,Color.DarkBlue,CoordSystem.World3D) {
     m_align = LabelAlign.Center; 
     m_padding = 3; 
 }
Beispiel #5
0
 /// <summary>
 /// Controls the position and alignment of the fieldLabel.
 /// </summary>
 public virtual Labelable.Builder LabelAlign(LabelAlign labelAlign)
 {
     this.ToComponent().LabelAlign = labelAlign;
     return(this as Labelable.Builder);
 }