示例#1
0
 /// <summary>
 /// Ve mot chuoi text
 /// </summary>
 /// <param name="s">chuoi can ve</param>
 /// <param name="e"></param>
 /// <param name="font"></param>
 /// <param name="y"></param>
 /// <returns></returns>
 public float POSDrawMessenge(string s, System.Drawing.Printing.PrintPageEventArgs e, Color color, System.Drawing.Font font, float y,TextAlign align,float margin)
 {
     while (s.Contains("  "))
     {
         s = s.Replace("  ", " ");
     }
     string[] list = s.Split(' ');
     string resuilt = "";
     for (int i = 0; i < list.Length; i++)            
     {
         string data = list[i];
         if (e.Graphics.MeasureString(resuilt + " " + data, font).Width > POSGetWidthPrinter(e))
         {
             y = POSDrawString(resuilt, e, font, color, y, align, margin);
             resuilt = data;
         }
         else
         {
             resuilt += data + " ";
             if (i == (list.Length - 1))
             {
                 y = POSDrawString(resuilt, e, font, color, y, align, margin);
             }
         }
     }
     SizeF size = e.Graphics.MeasureString(s, font);
     int x = (int)size.Width;
     return y;
 }
 internal void Compile(IEnumerator<HtmlChunk> source, int width, TextAlign align = TextAlign.Left, VertAlign valign = VertAlign.Bottom)
 {
     this.d.Clear();
     this.CompiledWidth = width;
     this.d.Parse(source, width, align, valign);
     this.UpdateHeight();
 }
示例#3
0
 public TextGlyph(float x, float y, string text, Font font, TextAlign textAlign = TextAlign.Left)
     : base(x, y)
 {
     _text = text;
     Font = font;
     TextAlign = textAlign;
 }
示例#4
0
		public TitleFrame()
		{
			this._verticalTextAlign = null;
			this._textAlign         = TextAlign.Right;
			this._titleLabel        = new Label();
			this._targetControl     = null;
		}
示例#5
0
 public FreeTextList()
 {
     this.TextList = new List<TextItem>();
     this.displayOffset = Microsoft.Xna.Framework.Point.Zero;
     this.align = TextAlign.None;
     this.textColor = Microsoft.Xna.Framework.Graphics.Color.Black;
     this.Builder = new FreeTextBuilder();
 }
示例#6
0
 public override void SetParagraphStyle(TextStyle style, TextAlign align)
 {
     _wordapp.Selection.set_Style(style.ToString());
     if (align == TextAlign.Right)
         _wordapp.Selection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight;
     else if (align == TextAlign.Center)
         _wordapp.Selection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;
 }
示例#7
0
 public TextDrawer(SpriteFont font, string text, Vector2 position, Color color, TextAlign align = TextAlign.Left)
 {
     this.font = font;
     this.text = text;
     this.Position = position;
     this.color = color;
     this.textAlign = align;
 }
示例#8
0
 public FreeText(FreeTextBuilder builder)
 {
     this.position = Microsoft.Xna.Framework.Rectangle.Empty;
     this.displayOffset = Microsoft.Xna.Framework.Point.Zero;
     this.align = TextAlign.None;
     this.textColor = Microsoft.Xna.Framework.Graphics.Color.Black;
     this.textTexture = null;
     this.Builder = builder;
 }
示例#9
0
 public TextField(Rectangle _Bounds)
     : base(_Bounds)
 {
     this.text = "";
     foreGroundColor = Color.Black;
     this.textAlign = TextAlign.Left;
     this.BackgroundGraphicPath = "Gui/TextField";
     this.isTextEditAble = true;
 }
示例#10
0
文件: HtCompiler.cs 项目: fengqk/Art
 internal void Compile(IEnumerator<HtmlChunk> source, int width, string id = null, HtFont font = null, HtColor color = default(HtColor), TextAlign align = TextAlign.Left, VertAlign valign = VertAlign.Bottom)
 {
     this.d.Clear();
     this.CompiledWidth = width;
     this.d.Parse(source, width, id, font, color, align, valign);
     this.MergeSameTextChunks();
     this.UpdateHeight();
     //this.UpdateWidth();
 }
示例#11
0
 protected LabelWidget(LabelWidget other)
     : base(other)
 {
     Text = other.Text;
     Align = other.Align;
     Bold = other.Bold;
     GetText = other.GetText;
     GetBackground = other.GetBackground;
 }
示例#12
0
 public FreeTextList(GraphicsDevice device, Font font, Microsoft.Xna.Framework.Graphics.Color color)
 {
     this.TextList = new List<TextItem>();
     this.displayOffset = Microsoft.Xna.Framework.Point.Zero;
     this.align = TextAlign.None;
     this.textColor = Microsoft.Xna.Framework.Graphics.Color.Black;
     this.Builder = new FreeTextBuilder();
     this.Builder.SetFreeTextBuilder(device, font);
     this.textColor = color;
 }
示例#13
0
		/// <summary>
		/// Title frame for control
		/// </summary>
		/// <param name="verticalTextAlign"></param>
		/// <param name="textAlign"></param>
		/// <param name="targetControl">Target control</param>
		public TitleFrame(VerticalTextAlign? verticalTextAlign, TextAlign textAlign, Control targetControl) : this()
		{
			this._titleLabel.AutoSize = true;
			this._titleLabel.Font     = new Font(this._titleLabel.Font, FontStyle.Bold | FontStyle.Underline);
			this._verticalTextAlign   = verticalTextAlign;
			this._textAlign           = textAlign;
			this._targetControl       = targetControl;

			InitializeComponent();
		}
示例#14
0
 public FreeText(GraphicsDevice device, Font font)
 {
     this.position = Microsoft.Xna.Framework.Rectangle.Empty;
     this.displayOffset = Microsoft.Xna.Framework.Point.Zero;
     this.align = TextAlign.None;
     this.textColor = Microsoft.Xna.Framework.Graphics.Color.Black;
     this.textTexture = null;
     this.Builder = new FreeTextBuilder();
     this.Builder.SetFreeTextBuilder(device, font);
 }
示例#15
0
 public void BoundBoxTest()
 {
     SpriteFont font = null; // TODO: Initialize to an appropriate value
     string text = string.Empty; // TODO: Initialize to an appropriate value
     Vector2 position = new Vector2(); // TODO: Initialize to an appropriate value
     Color color = new Color(); // TODO: Initialize to an appropriate value
     TextAlign align = new TextAlign(); // TODO: Initialize to an appropriate value
     TextDrawer target = new TextDrawer(font, text, position, color, align); // TODO: Initialize to an appropriate value
     Rectangle actual;
     actual = target.BoundBox;
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
示例#16
0
 public void DrawTest()
 {
     SpriteFont font = null; // TODO: Initialize to an appropriate value
     string text = string.Empty; // TODO: Initialize to an appropriate value
     Vector2 position = new Vector2(); // TODO: Initialize to an appropriate value
     Color color = new Color(); // TODO: Initialize to an appropriate value
     TextAlign align = new TextAlign(); // TODO: Initialize to an appropriate value
     TextDrawer target = new TextDrawer(font, text, position, color, align); // TODO: Initialize to an appropriate value
     SpriteBatch sb = null; // TODO: Initialize to an appropriate value
     target.Draw(sb);
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
示例#17
0
 /// <summary>
 /// Creates a displayable text game object.
 /// </summary>
 /// <param name="text">The text that is displayed.</param>
 /// <param name="x">The x position of the object.</param>
 /// <param name="y">The y position of the object.</param>
 /// <param name="width">The width of the bounding rectangle.</param>
 /// <param name="height">The height of the bounding rectangle.</param>
 public GenText(string text = null, float x = 0, float y = 0, int width = 1, int height = 1)
     : base(x, y, null, width, height)
 {
     // Set the font type of the text to the default font.
     Font = GenG.Font;
     _textMeasure = Vector2.Zero;
     Text = (text == null) ? String.Empty : text;
     TextAlignment = TextAlign.Left;
     _textOrigin = Vector2.Zero;
     HasShadow = false;
     ShadowColor = Color.Black;
     ShadowPosition = new Vector2(0f, 2f);
 }
示例#18
0
文件: Radio.cs 项目: temur03/imBMW
        public static void DisplayText(string s, TextAlign align = TextAlign.Left)
        {
            ClearTimer();

            if (HasMID)
            {
                DisplayTextMID(s, align);
            }
            else
            {
                DisplayTextRadio(s, align);
            }
        }
示例#19
0
文件: Radio.cs 项目: temur03/imBMW
        public static void DisplayTextWithDelay(string s, int delay, TextAlign align = TextAlign.Left, Message[] messageSendAfter = null)
        {
            ClearTimer();

            displayTextDelayTimer = new Timer(delegate
            {
                DisplayText(s, align);
                if (messageSendAfter != null)
                {
                    Manager.EnqueueMessage(messageSendAfter);
                }
            }, null, delay, 0);
        }
示例#20
0
 protected LabelWidget(LabelWidget other)
     : base(other)
 {
     Text = other.Text;
     Align = other.Align;
     Font = other.Font;
     TextColor = other.TextColor;
     Contrast = other.Contrast;
     ContrastColor = other.ContrastColor;
     WordWrap = other.WordWrap;
     GetText = other.GetText;
     GetColor = other.GetColor;
     GetContrastColor = other.GetContrastColor;
 }
示例#21
0
 /// <summary>
 /// Draws text to the specified region, overriding its layout parameters.
 /// </summary>
 public void DrawText(Color Color, TextSample Sample, Rectangle Region, TextAlign HorizontalAlign, TextAlign VerticalAlign)
 {
     double x = Region.Location.X;
     double y = Region.Location.Y;
     switch (HorizontalAlign)
     {
         case TextAlign.Center: x += Region.Size.X / 2.0 - Sample.Size.X / 2.0; break;
         case TextAlign.Right: x += Region.Size.X - Sample.Size.X; break;
     }
     switch (VerticalAlign)
     {
         case TextAlign.Center: y += Region.Size.Y / 2.0 - Sample.Size.Y / 2.0; break;
         case TextAlign.Bottom: y += Region.Size.Y - Sample.Size.Y; break;
     }
     this.DrawText(Color, Sample, new Point(x, y));
 }
示例#22
0
 protected LabelWidget(LabelWidget other)
     : base(other)
 {
     Text = other.Text;
     Align = other.Align;
     Font = other.Font;
     TextColor = other.TextColor;
     Contrast = other.Contrast;
     ContrastColorDark = other.ContrastColorDark;
     ContrastColorLight = other.ContrastColorLight;
     Shadow = other.Shadow;
     WordWrap = other.WordWrap;
     GetText = other.GetText;
     GetColor = other.GetColor;
     GetContrastColorDark = other.GetContrastColorDark;
     GetContrastColorLight = other.GetContrastColorLight;
 }
示例#23
0
        public TextAtom(float orgX, float orgY, V2DTextRun tr)
        {
            this.Text = tr.Text;
            this.Font = FontManager.Instance.GetFont(tr.FontName);
            //this.Origin = new Microsoft.Xna.Framework.Vector2(orgX + tr.Left, orgY + tr.Top);
            this.Origin = new Microsoft.Xna.Framework.Vector2(tr.Left, tr.Top);

            uint c = tr.Color;
            byte a = (byte)(c >> 24);
            byte r = (byte)(c >> 16);
            byte g = (byte)(c >> 8);
            byte b = (byte)(c >> 0);
            this.Color = new Color(r, g, b, a);

            this.LetterSpacing = GetAttributeValue(tr.Text, "letterSpacing");
            this.Kerning = GetAttributeValue(tr.Text, "kerning");
            this.Align = GetAlign(tr.Text);
        }
示例#24
0
        public static string GetName(TextAlign type)
        {
            string result = String.Empty;

            switch (type)
            {
                case TextAlign.Left:
                    result = "left";
                    break;
                case TextAlign.Center:
                    result = "center";
                    break;
                case TextAlign.Right:
                    result = "right";
                    break;
            }

            return result;
        }
示例#25
0
文件: IMGUI.cs 项目: RastaCow/Nez
		static void drawString( string text, Color color, TextAlign align = TextAlign.Center, float elementHeight = ELEMENT_HEIGHT )
		{
			// center align the text
			var textSize = _font.measureString( text ) * FONT_SCALE.Y;
			float x = _elementX;
			switch( align )
			{
				case TextAlign.Center:
					x += ( _elementWidth - textSize.X ) * 0.5f;
					break;
				case TextAlign.Right:
					x = _elementX + _elementWidth - textSize.X;
					break;
			}

			var y = _lastY + ELEMENT_PADDING + ( elementHeight - FONT_LINE_HEIGHT ) * 0.5f;

			_spriteBatch.DrawString( _font, text, new Vector2( x, y ), color, 0, Vector2.Zero, FONT_SCALE, SpriteEffects.None, 0 );
		}
示例#26
0
        public void Draw(SpriteBatch spriteBatch, SpriteFont font, Vector2 position, TextAlign align, int? width, float alpha)
        {
            Vector2 offset = new Vector2(0, 0);
            //foreach (Word w in Words) {
            for (int i = 0; i <= (FullyTyped ? Words.Count - 1 : CurrentWordIndex); i++) {
                Word w = Words[i];
                switch (w.Type) {
                    case Word.WordType.Newline:
                        offset.X = 0;
                        offset.Y += font.LineSpacing;
                        break;
                    case Word.WordType.Text:
                        if (offset.X + font.MeasureString(w.Text + " ").X > width) {
                            offset.X = 0;
                            offset.Y += font.LineSpacing;
                        }
                        spriteBatch.DrawStringOutlined(font, w.Text + " ", position + offset, w.Color * alpha);
                        offset.X += font.MeasureString(w.Text + " ").X;
                        break;
                    case Word.WordType.Icon:
                        int iconHeight = (int)font.LineSpacing;

                        if (w.Icon == GameSession.Current.Pixel) {
                            spriteBatch.DrawStringOutlined(GameSession.Current.KeyboardFont, w.Text, position + offset, w.Color * alpha);
                            offset.X += GameSession.Current.KeyboardFont.MeasureString(w.Text).X + font.MeasureString(" ").X;
                        }
                        else {
                            int iconWidth = w.Icon.Width / w.Icon.Height * iconHeight;
                            if (offset.X + w.Icon.Width > width) {
                                offset.X = 0;
                                offset.Y += font.LineSpacing;
                            }
                            spriteBatch.Draw(w.Icon, new Rectangle((int)(position.X + offset.X), (int)(position.Y + offset.Y), iconWidth, iconHeight), Color.White * alpha);
                            offset.X += iconWidth + font.MeasureString(" ").X;
                        }
                        break;
                }
            }
        }
示例#27
0
        public float POSDrawString(string s, System.Drawing.Printing.PrintPageEventArgs e, System.Drawing.Font font, Color color, float x,float y,float width, TextAlign textAlign)
        {            
            List<string> list = POSSplitStringLine(s,width,e, font);
            foreach (string item in list)
            {
                switch (textAlign)
                {                    
                    case TextAlign.Center:
                        x += (float)Math.Abs((width - e.Graphics.MeasureString(item, font).Width) / 2);
                        break;
                    case TextAlign.Right:
                        x += width - e.Graphics.MeasureString(item, font).Width;
                        break;
                    default:
                        break;
                }
                e.Graphics.DrawString(item, font, new SolidBrush(color), x, y);
                y += e.Graphics.MeasureString(item, font).Height;
            }

            return y;
        }
示例#28
0
      // computes the exact bounds for drawing the text glyph so it appears in the target area with the given alignment
      private Rect _computeBounds(Rect targetArea, TextAlign alignment) {
         // horizontal alignment
         var halign = (TextAlign)((int)alignment & 0x00FF);
         var ispoint = targetArea.Size.IsZero();
         var isclipped = (TextOverflow != TextOverflow.Ignore);
         var dw = (isclipped ? (targetArea.Width - Width).Max(0) : targetArea.Width - Width);
         switch (halign) {

            case TextAlign.Before:
               targetArea.X -= Width;
               isclipped = false;
               break;

            case TextAlign.After:
               targetArea.X += targetArea.Width;
               isclipped = false;
               break;

            case TextAlign.Left:
               break;

            case TextAlign.Right:
               targetArea.X += dw;
               break;

            default:
               targetArea.X += dw / 2;
               break;

         }
         if (ispoint) {
            targetArea.Width = Double.PositiveInfinity;
         } else if (isclipped) {
            targetArea.Width = Math.Ceiling(Math.Min(targetArea.Width, Width));
         } else {
            targetArea.Width = Math.Ceiling(Width);
         }

         // vertical alignment
         var valign = (TextAlign)((int)alignment & 0xFF00);
         switch (valign) {

            case TextAlign.Above:
               targetArea.Y -= Height;
               break;

            case TextAlign.Below:
               targetArea.Y += targetArea.Height;
               break;

            case TextAlign.Top:
               break;

            case TextAlign.Bottom:
               targetArea.Y += targetArea.Height - Height;
               break;

            case TextAlign.Baseline:
               targetArea.Y += targetArea.Height - Baseline;
               break;

            default:
               targetArea.Y += (targetArea.Height - Height) / 2;
               break;

         }
         if (ispoint) {
            targetArea.Height = Double.PositiveInfinity;
         } else {
            targetArea.Height = Math.Ceiling(Height);
         }

         // snap to pixels
         if ((alignment & TextAlign.SnapToPixel) != 0) {
            targetArea.X = Math.Round(targetArea.X);
            targetArea.Y = Math.Round(targetArea.Y);
         }

         return targetArea;
      }
 public static void ShowNormalTextWithGong(string text, TextAlign align = TextAlign.Left, int timeout = 5000)
 {
     ShowTextForSomePeriodOfTime(text, align, TextMode.WithGong1, timeout);
 }
示例#30
0
文件: Font.cs 项目: T0chi/StorygenCC
        public Sentence WriteSentence(String Text, int Time, Vector2 Position, Origin Origin, Layer Layer, TextAlign Alignment, bool ScaleSprite = true, bool CharByChar = true, double Scale = 480.0 / 1080.0)
        {
            Text = Text.Trim();

            List <Sprite> TextSprites = new List <Sprite>();

            double X = Position.X;
            double Y = Position.Y;

            double SentenceSize = 0;

            if (CharByChar)
            {
                foreach (char c in Text)
                {
                    SentenceSize += c == ' ' ? Scale * Size * 0.35 : Scale *CreateSprite(c.ToString()).getWidth() - Size * Scale * 0.45;
                }
            }
            else
            {
                SentenceSize = Scale * CreateSprite(Text).getWidth() - Size * Scale;
            }

            double XDec = -Size / 10;

            switch (Alignment)
            {
            case TextAlign.Left:
            {
                break;
            }

            case TextAlign.Centre:
            {
                XDec -= SentenceSize / 2;
                break;
            }

            case TextAlign.Right:
            {
                XDec -= SentenceSize;
                break;
            }
            }

            if (CharByChar)
            {
                foreach (char c in Text)
                {
                    if (c.Equals(' '))
                    {
                        X += Scale * Size * 0.35;
                        continue;
                    }

                    FontText s = CreateSprite(c.ToString());
                    Vector2  Dec = decByOrigin(Origin, Scale, s.getWidth(), s.getHeight());
                    double   LayerDecX = Dec.X, LayerDecY = Dec.Y;

                    Sprite Sprite = Layer.CreateSprite(Path + s.getFileName() + ".png", Origin, X + LayerDecX + XDec, Y + LayerDecY);
                    if (ScaleSprite)
                    {
                        Sprite.Scale(Time, Scale);
                    }

                    X += Scale * s.getWidth() - Size * Scale * 0.45;
                    TextSprites.Add(Sprite);
                }
            }
            else
            {
                FontText s = CreateSprite(Text);
                Vector2  Dec = decByOrigin(Origin, Scale, s.getWidth(), s.getHeight());
                double   LayerDecX = Dec.X, LayerDecY = Dec.Y;
                Sprite   Sprite = Layer.CreateSprite(Path + s.getFileName() + ".png", Origin, X + LayerDecX + XDec, Y + LayerDecY);
                if (ScaleSprite)
                {
                    Sprite.Scale(Time, Scale);
                }

                TextSprites.Add(Sprite);
            }

            return(new Sentence(SentenceSize, TextSprites, Alignment));
        }
示例#31
0
 public async Task SetTextAlignAsync(TextAlign value)
 {
     this.TextAlign = value;
     await this.BatchCallAsync("textAlign", isMethodCall : false, value.ToString().ToLowerInvariant());
 }
 public Vector2 DrawText(UniversalFont font, SharedString text, Rectangle target, TextAlign align, Color color, TextRotation rotation = TextRotation.None)
 {
     return(DrawText(font, text, target, align, color, 0, 0, 1));
 }
        public Vector2 DrawText(UniversalFont font, StringBuilder text, Point position, TextAlign align, Color color)
        {
            Rectangle target = new Rectangle(position.X, position.Y, 0, 0);

            return(DrawText(font, text, target, align, color));
        }
 public Vector2 DrawText(UniversalFont font, SharedString text, Point position, TextAlign align, Color color)
 {
     return(DrawText(font, text, position, align, color, 0, 0, 1));
 }
示例#35
0
 protected ExcelRange InsertLabel(string value, int colOffset = 0, TextAlign AlignMode = TextAlign.RIGHT, int?col = null, int?row = null)
 {
     return(insertValue(value, "label", colOffset, AlignMode, col: col, row: row));
 }
        private void PreprocessElement(XmlDocument document, XmlElement element, ref List <PreprocessorAreaData> datas, PreprocessorAreaData parentArea = null)
        {
            List <XmlElement> nodes = element.ChildNodes.OfType <XmlElement>().ToList();

            foreach (XmlElement subElement in nodes)
            {
                if (subElement == null)
                {
                    continue;
                }

                switch (subElement.Name.ToLower())
                {
                case "mssqlauditorpreprocessor":
                {
                    string className = subElement.Attributes["preprocessor"].Value;

                    XmlAttribute idAttr        = subElement.Attributes["id"];
                    XmlAttribute nameAttr      = subElement.Attributes["name"];
                    XmlAttribute columnAttr    = subElement.Attributes["column"];
                    XmlAttribute rowAttr       = subElement.Attributes["row"];
                    XmlAttribute colSpanAttr   = subElement.Attributes["colspan"];
                    XmlAttribute rowSpanAttr   = subElement.Attributes["rowspan"];
                    XmlAttribute vertTestAlign = subElement.Attributes["text-vertical-align"];
                    XmlAttribute textAlign     = subElement.Attributes["text-align"];

                    string id          = "";
                    string preprocName = "unnamed";

                    if (nameAttr != null)
                    {
                        preprocName = nameAttr.Value;
                    }

                    if (idAttr != null)
                    {
                        id = idAttr.Value;
                    }

                    int col     = ParseIntAttribute(columnAttr, 1);
                    int row     = ParseIntAttribute(rowAttr, 1);
                    int colSpan = ParseIntAttribute(colSpanAttr, 1);
                    int rowSpan = ParseIntAttribute(rowSpanAttr, 1);

                    VerticalTextAlign?preprocVertTestAlign = null;

                    if (vertTestAlign != null)
                    {
                        VerticalTextAlign tempVertTestAlign;

                        if (Enum.TryParse(vertTestAlign.Value, out tempVertTestAlign))
                        {
                            preprocVertTestAlign = tempVertTestAlign;
                        }
                    }

                    TextAlign preprocTestAlign = TextAlign.Left;

                    if (textAlign != null)
                    {
                        if (!Enum.TryParse(textAlign.Value, out preprocTestAlign))
                        {
                            preprocTestAlign = TextAlign.Left;
                        }
                    }

                    IPreprocessor preprocessor =
                        (from proc in this._availablePreprocessors where proc.GetType().Name == className select proc)
                        .FirstOrDefault();

                    if (preprocessor != null)
                    {
                        string          configuration = subElement.InnerXml;
                        IContentFactory factory       = preprocessor.CreateContentFactory(id, configuration);

                        PreprocessorData data = new PreprocessorData
                        {
                            ContentFactory    = factory,
                            Name              = preprocName,
                            Column            = col,
                            Row               = row,
                            ColSpan           = colSpan,
                            RowSpan           = rowSpan,
                            VerticalTextAlign = preprocVertTestAlign,
                            TextAlign         = preprocTestAlign
                        };

                        XmlElement newSubElement = document.CreateElement("div");

                        newSubElement.SetAttribute("style", "margin:0; padding:0;");
                        newSubElement.InnerXml = string.Empty;

                        element.ReplaceChild(newSubElement, subElement);

                        if (parentArea != null)
                        {
                            parentArea.Preprocessors.Add(data);
                        }
                        else
                        {
                            log.ErrorFormat(
                                "Invalid configuration: <mssqlauditorpreprocessor> is not embedded in <mssqlauditorpreprocessors>. " +
                                "Are you using old style configuration file?" + Environment.NewLine +
                                "Silently ignoring '{0}' with id='{1}' and name='{2}'",
                                className,
                                id,
                                preprocName
                                );

                            throw new ArgumentOutOfRangeException(
                                      "document",
                                      "Invalid configuration: <mssqlauditorpreprocessor> is not embedded in <mssqlauditorpreprocessors>!"
                                      );
                        }
                        continue;
                    }
                    break;
                }

                case "mssqlauditorpreprocessors":
                {
                    XmlAttribute idAttr       = subElement.Attributes["id"];
                    XmlAttribute nameAttr     = subElement.Attributes["name"];
                    XmlAttribute rowsAttr     = subElement.Attributes["rows"];
                    XmlAttribute columnsAttr  = subElement.Attributes["columns"];
                    XmlAttribute splitterAttr = subElement.Attributes["splitter"];

                    string id       = "";
                    string name     = "unnamed";
                    string rows     = "";
                    string columns  = "";
                    string splitter = "";

                    if (nameAttr != null)
                    {
                        name = nameAttr.Value;
                    }
                    if (idAttr != null)
                    {
                        id = idAttr.Value;
                    }
                    if (columnsAttr != null)
                    {
                        columns = columnsAttr.Value;
                    }
                    if (rowsAttr != null)
                    {
                        rows = rowsAttr.Value;
                    }
                    if (splitterAttr != null)
                    {
                        splitter = splitterAttr.Value;
                    }

                    PreprocessorAreaData container = new PreprocessorAreaData(id, name, columns, rows);

                    if (string.Equals(splitter, "no", StringComparison.InvariantCultureIgnoreCase))
                    {
                        container.NoSplitter = true;
                    }

                    datas.Add(container);

                    PreprocessElement(document, subElement, ref datas, container);

                    container.CheckPreprocessors();

                    continue;
                }
                }

                PreprocessElement(document, subElement, ref datas);
            }
        }
示例#37
0
 protected ExcelRange InsertString(string value, int colOffset = 0, TextAlign AlignMode = TextAlign.LEFT, float fontSize = 9, bool fontBold = false, ExcelVerticalAlignment VerticalAlign = ExcelVerticalAlignment.Center, int?col = null, int?row = null)
 {
     return(insertValue(value, "string", colOffset, AlignMode, fontSize: fontSize, fontBold: fontBold, VerticalAlign: VerticalAlign, col: col, row: row));
 }
示例#38
0
 public _Editable(TextSpan textSpan                  = null, TextEditingValue value          = null,
                  Color cursorColor                  = null, ValueNotifier <bool> showCursor = null, bool hasFocus = false,
                  int?maxLines                       = null, Color selectionColor   = null, float textScaleFactor  = 1.0f,
                  TextDirection?textDirection        = null, bool obscureText       = false, TextAlign textAlign   = TextAlign.left,
                  bool autocorrect                   = false, ViewportOffset offset = null, SelectionChangedHandler onSelectionChanged = null,
                  CaretChangedHandler onCaretChanged = null, bool rendererIgnoresPointer = false,
                  Key key = null) : base(key)
 {
     this.textSpan               = textSpan;
     this.value                  = value;
     this.cursorColor            = cursorColor;
     this.showCursor             = showCursor;
     this.hasFocus               = hasFocus;
     this.maxLines               = maxLines;
     this.selectionColor         = selectionColor;
     this.textScaleFactor        = textScaleFactor;
     this.textAlign              = textAlign;
     this.textDirection          = textDirection;
     this.obscureText            = obscureText;
     this.autocorrect            = autocorrect;
     this.offset                 = offset;
     this.onSelectionChanged     = onSelectionChanged;
     this.onCaretChanged         = onCaretChanged;
     this.rendererIgnoresPointer = rendererIgnoresPointer;
 }
示例#39
0
 public override GFXPath GetTextPath(string txt, double x, double y, double size, double angle, TextAlign align, Transform2d t)
 {
     return(MeasurePainter.GetTextPath(txt, x, y, size, angle, align, t));
 }
示例#40
0
                /// <summary>
                /// Displays the specified text within the specified rectangular region.
                /// </summary>
                /// <param name="text">The text to display.</param>
                /// <param name="x">The X coordinate of the rectangular region.</param>
                /// <param name="y">The Y coordinate of the rectangular region.</param>
                /// <param name="width">The width of the rectangular region.</param>
                /// <param name="height">The height of the rectangular region.</param>
                /// <param name="color">The text color.</param>
                /// <param name="font">The text font.</param>
                /// <param name="textAlignment">A value from the <see cref="TextAlign"/> enumeration that specifies how to align the text within the rectangular region.</param>
                /// <param name="wordWrap">A value from the <see cref="WordWrap"/> enumeration that specifies how to wrap the text within the rectangular region.</param>
                /// <param name="trimming">A value from the <see cref="Trimming"/> enumeration that specifies how to trim excess text.</param>
                /// <param name="scaleTextToFit">A value from the <see cref="ScaleText"/> enumeration that specifies how the text should be scaled.</param>
                public void DisplayTextInRectangle(string text, uint x, uint y, uint width, uint height,
                    Color color, Font font, TextAlign textAlignment, WordWrap wordWrap, Trimming trimming, ScaleText scaleTextToFit)
                {
                    uint dtFlags = Bitmap.DT_None;

                    switch (textAlignment)
                    {
                        case TextAlign.Center:
                            dtFlags |= Bitmap.DT_AlignmentCenter;
                            break;
                        case TextAlign.Left:
                            dtFlags |= Bitmap.DT_AlignmentLeft;
                            break;
                        case TextAlign.Right:
                            dtFlags |= Bitmap.DT_AlignmentRight;
                            break;
                        default:
                            break;
                    }

                    switch (trimming)
                    {
                        case Trimming.CharacterEllipsis:
                            dtFlags |= Bitmap.DT_TrimmingCharacterEllipsis;
                            break;
                        case Trimming.WordEllipsis:
                            dtFlags |= Bitmap.DT_TrimmingWordEllipsis;
                            break;
                        default:
                            break;
                    }


                    if (wordWrap == WordWrap.Wrap)
                        dtFlags |= Bitmap.DT_WordWrap;

                    if (scaleTextToFit == ScaleText.None)
                        dtFlags |= Bitmap.DT_IgnoreHeight;

                    _display.DrawTextInRect(text, (int)x, (int)y, (int)width, (int)height, dtFlags, color, font);

                    if (AutoRedraw) Redraw();
                }
示例#41
0
 public virtual void PrintTextFiscal(string text, TextAlign align)
 {
     throw new NotSupportedException();
 }
示例#42
0
 protected ExcelRange InsertPercentage(double?value, int colOffset = 0, Precision Decimals = Precision.ZERO, TextAlign AlignMode = TextAlign.LEFT, int?col = null, int?row = null)
 {
     return(insertValue(value, "percentage", colOffset, AlignMode, Decimals: Decimals, col: col, row: row));
 }
        public Vector2 DrawText(UniversalFont font, SharedString text, Point position, TextAlign align, Color color, float spacing, float lineHeight, float scale)
        {
            Rectangle target = new Rectangle(position.X, position.Y, 0, 0);

            lock (text)
            {
                return(DrawText(font, text.StringBuilder, target, align, color, spacing, lineHeight, scale, TextRotation.None));
            }
        }
示例#44
0
 protected ExcelRange InsertSubtitle(string value, int colOffset = 0, TextAlign AlignMode = TextAlign.LEFT, int?col = null, int?row = null)
 {
     return(insertValue(value, "subtitle", colOffset, AlignMode, col: col, row: row));
 }
        public Vector2 DrawText(UniversalFont font, string text, Point position, TextAlign align, Color color, float spacing, float lineHeight, float scale)
        {
            Rectangle target = new Rectangle(position.X, position.Y, 0, 0);

            return(DrawText(font, text, target, align, color, spacing, lineHeight, scale));
        }
示例#46
0
 protected ExcelRange InsertDateTime(DateTime?value, int colOffset = 0, TextAlign AlignMode = TextAlign.CENTER, int?col = null, int?row = null)
 {
     return(insertValue(value, "datetime", colOffset, AlignMode, col: col, row: row));
 }
 public Vector2 DrawText(UniversalFont font, SharedString text, Rectangle target, TextAlign align, Color color, float spacing, float lineHeight, float scale, TextRotation rotation = TextRotation.None)
 {
     lock (text)
     {
         return(DrawText(font, text.StringBuilder, target, align, color, spacing, lineHeight, scale, rotation));
     }
 }
示例#48
0
        private ExcelRange insertValue(object value, string sType, int offset, TextAlign AlignMode = TextAlign.LEFT, Precision Decimals = Precision.ZERO, NumberTypes Type = NumberTypes.NUMBER, int mergeCols = 1, int?rowsOccuppied = null, float fontSize = 9, bool fontBold = false, ExcelVerticalAlignment VerticalAlign = ExcelVerticalAlignment.Center, int?col = null, int?row = null)
        {
            int targetColumn;
            int targetRow;

            if (col != null)
            {
                targetColumn = (int)col;
            }
            else
            {
                colIndex    += offset;
                targetColumn = colIndex;
            }

            if (row != null)
            {
                targetRow = (int)row;
            }
            else
            {
                targetRow = rowIndex;
            }


            if (targetColumn > maxColIndex)
            {
                maxColIndex = targetColumn;
            }

            if (mergeCols > 1)
            {
                if (targetColumn + mergeCols > maxColIndex)
                {
                    maxColIndex = targetColumn + mergeCols;
                }
            }

            if (rowsOccuppied != null)
            {
                ws.Row(rowIndex).Height = (int)rowsOccuppied * baseRowHeight;
            }

            ExcelRange cell = ws.Cells[targetRow, targetColumn];

            if (inTable)
            {
                TD(cell);
            }

            switch (sType)
            {
            case "formula":
                FormatNumber(cell, Type: Type, Decimals: Decimals);
                if (value == null)
                {
                    cell.Value = "";
                }
                else
                {
                    cell.Formula = (string)value;
                }
                break;

            case "string":
                switch (AlignMode)
                {
                case TextAlign.LEFT:
                    cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;
                    break;

                case TextAlign.CENTER:
                    cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                    break;

                case TextAlign.RIGHT:
                    cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;
                    break;

                default:
                    break;
                }
                cell.Style.VerticalAlignment = VerticalAlign;
                cell.Style.Font.Size         = fontSize;
                cell.Style.Font.Bold         = fontBold;
                if (string.IsNullOrWhiteSpace((string)value))
                {
                    cell.Value = null;
                }
                else
                {
                    cell.Value = (string)value;
                }
                break;

            case "paragraph":
                if (mergeCols > 1)
                {
                    cell       = ws.Cells[cell.Address + ":" + cell.Offset(0, mergeCols).Address];
                    cell.Merge = true;
                }
                cell.Style.WrapText = true;

                switch (AlignMode)
                {
                case TextAlign.LEFT:
                    cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;
                    break;

                case TextAlign.CENTER:
                    cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                    break;

                case TextAlign.RIGHT:
                    cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;
                    break;

                default:
                    break;
                }
                if (value == null)
                {
                    cell.Value = "";
                }
                else
                {
                    cell.Value = (string)value;
                }
                break;

            case "number":
            case "double":
                FormatNumber(cell, Type: NumberTypes.NUMBER, Decimals: Decimals);
                if (value == null)
                {
                    cell.Value = 0;
                }
                else
                {
                    cell.Value = value;
                    try
                    {
                        if ((decimal)(double)value < 0)
                        {
                            cell.Style.Font.Color.SetColor(Color.Red);
                        }
                    }
                    catch { }
                }
                break;

            case "currency":
                FormatNumber(cell, Type: NumberTypes.CURRENCY, Decimals: Decimals);
                if (value == null)
                {
                    cell.Value = 0;
                }
                else
                {
                    cell.Value = value;
                    try
                    {
                        if ((decimal)(double)value < 0)
                        {
                            cell.Style.Font.Color.SetColor(Color.Red);
                        }
                    }
                    catch { }
                }
                break;

            case "percentage":
                FormatNumber(cell, Type: NumberTypes.PERCENTAGE, Decimals: Decimals);

                switch (AlignMode)
                {
                case TextAlign.LEFT:
                    cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;
                    break;

                case TextAlign.CENTER:
                    cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                    break;

                case TextAlign.RIGHT:
                    cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;
                    break;

                default:
                    break;
                }

                if (value == null)
                {
                    cell.Value = 0;
                }
                else
                {
                    cell.Value = (double)value;
                    try
                    {
                        if ((double)value < 0)
                        {
                            cell.Style.Font.Color.SetColor(Color.Red);
                        }
                    }
                    catch { }
                }
                break;

            case "title":
                cell.Style.Font.Size    = 18;
                ws.Row(rowIndex).Height = 23;

                switch (AlignMode)
                {
                case TextAlign.LEFT:
                    cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;
                    break;

                case TextAlign.CENTER:
                    cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                    break;

                case TextAlign.RIGHT:
                    cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;
                    break;

                default:
                    break;
                }
                cell.Style.VerticalAlignment = ExcelVerticalAlignment.Bottom;
                cell.Value = (string)value;
                break;

            case "subtitle":
                cell.Style.Font.Bold = true;
                cell.Style.Font.Size = 14;
                switch (AlignMode)
                {
                case TextAlign.LEFT:
                    cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;
                    break;

                case TextAlign.CENTER:
                    cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                    break;

                case TextAlign.RIGHT:
                    cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;
                    break;

                default:
                    break;
                }
                cell.Value = (string)value;
                break;

            case "label":
                cell.Style.Font.Bold = true;
                cell.Style.WrapText  = true;
                switch (AlignMode)
                {
                case TextAlign.LEFT:
                    cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;
                    break;

                case TextAlign.CENTER:
                    cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                    break;

                case TextAlign.RIGHT:
                    cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;
                    break;

                default:
                    break;
                }
                cell.Value = (string)value;
                break;

            case "date":
                cell.Style.Numberformat.Format = "dd-mmm-yyyy";

                switch (AlignMode)
                {
                case TextAlign.LEFT:
                    cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;
                    break;

                case TextAlign.CENTER:
                    cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                    break;

                case TextAlign.RIGHT:
                    cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;
                    break;

                default:
                    break;
                }
                if (value == null)
                {
                    cell.Value = "";
                }
                else
                {
                    DateTime theDate = (DateTime)value;
                    cell.Formula = "=DATE(" + theDate.Year + "," + theDate.Month + "," + theDate.Day + ")";
                }
                break;

            case "datetime":
                cell.Style.Numberformat.Format = "dd-mmm-yyyy h:mm";

                switch (AlignMode)
                {
                case TextAlign.LEFT:
                    cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;
                    break;

                case TextAlign.CENTER:
                    cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                    break;

                case TextAlign.RIGHT:
                    cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;
                    break;

                default:
                    break;
                }
                if (value == null)
                {
                    cell.Value = "";
                }
                else
                {
                    DateTime theDate = (DateTime)value;
                    cell.Formula = "=DATE(" + theDate.Year + "," + theDate.Month + "," + theDate.Day + ") + TIME(" + theDate.Hour + "," + theDate.Minute + "," + theDate.Second + ")";
                }
                break;

            case "bool":
                cell.Value = value;
                break;
            }
            if (col == null && row == null)
            {
                tab();
            }

            return(cell);
        }
        public Vector2 DrawText(UniversalFont font, StringBuilder text, Rectangle target, TextAlign align, Color color, float spacing, float lineHeight, float scale, TextRotation rotation = TextRotation.None)
        {
            if (font == null || text == null)
            {
                return(Vector2.Zero);
            }

            Font = font;

            Vector2 size     = _font.MeasureString(text, spacing, lineHeight) * scale;
            Vector2 position = TextPosition(ref target, align, size, rotation);



            if (_font.SitanaFont != null)
            {
                PrimitiveType = PrimitiveType.TriangleList;

                PrimitiveBatchNeeded();
                _font.SitanaFont.Draw(_primitiveBatch, text, position, color, spacing, lineHeight, scale, rotation);
            }
            else
            {
                Vector2 origin = TextOrigin(align, size);
                position.X += origin.X * scale;

                SpriteBatchIsNeeded();
                _spriteBatch.DrawString(_font.SpriteFont, text, position, color, 0, origin, scale, SpriteEffects.None, 0);
            }

            return(size);
        }
示例#50
0
        public MarkdownStyleSheet(
            TextStyle a,
            TextStyle p,
            TextStyle code,
            TextStyle h1,
            TextStyle h2,
            TextStyle h3,
            TextStyle h4,
            TextStyle h5,
            TextStyle h6,
            TextStyle em,
            TextStyle strong,
            TextStyle del,
            TextStyle blockquote,
            TextStyle img,
            TextStyle checkbox,
            float blockSpacing,
            float listIndent,
            TextStyle listBullet,
            TextStyle tableHead,
            TextStyle tableBody,
            TextAlign tableHeadAlign,
            TableBorder tableBorder,
            TableColumnWidth tableColumnWidth,
            EdgeInsets tableCellsPadding,
            Decoration tableCellsDecoration,
            EdgeInsets blockquotePadding,
            Decoration blockquoteDecoration,
            EdgeInsets codeblockPadding,
            Decoration codeblockDecoration,
            Decoration horizontalRuleDecoration,
            float textScaleFactor = 1.0f
            )
        {
            this.a                        = a;
            this.p                        = p;
            this.code                     = code;
            this.h1                       = h1;
            this.h2                       = h2;
            this.h3                       = h3;
            this.h4                       = h4;
            this.h5                       = h5;
            this.h6                       = h6;
            this.em                       = em;
            this.strong                   = strong;
            this.del                      = del;
            this.blockquote               = blockquote;
            this.img                      = img;
            this.checkbox                 = checkbox;
            this.blockSpacing             = blockSpacing;
            this.listIndent               = listIndent;
            this.listBullet               = listBullet;
            this.tableHead                = tableHead;
            this.tableBody                = tableBody;
            this.tableHeadAlign           = tableHeadAlign;
            this.tableBorder              = tableBorder;
            this.tableColumnWidth         = tableColumnWidth;
            this.tableCellsPadding        = tableCellsPadding;
            this.tableCellsDecoration     = tableCellsDecoration;
            this.blockquotePadding        = blockquotePadding;
            this.blockquoteDecoration     = blockquoteDecoration;
            this.codeblockPadding         = codeblockPadding;
            this.codeblockDecoration      = codeblockDecoration;
            this.horizontalRuleDecoration = horizontalRuleDecoration;
            this.textScaleFactor          = textScaleFactor;

            this._styles = new Dictionary <string, TextStyle>()
            {
                { "a", a },
                { "p", p },
                { "li", p },
                { "code", code },
                { "pre", p },
                { "h1", h1 },
                { "h2", h2 },
                { "h3", h3 },
                { "h4", h4 },
                { "h5", h5 },
                { "h6", h6 },
                { "em", em },
                { "strong", strong },
                { "del", del },
                { "blockquote", blockquote },
                { "img", img },
                { "table", p },
                { "th", tableHead },
                { "tr", tableHead },
                { "td", tableHead },
            };
        }
示例#51
0
文件: CheckBox.cs 项目: raj581/Marvin
        override void Render(HtmlTextWriter w)
        {
            Page page = Page;

            if (page != null)
            {
                page.VerifyRenderingInServerForm(this);
#if NET_2_0
                page.ClientScript.RegisterForEventValidation(UniqueID);
#endif
            }

            bool need_span = ControlStyleCreated && !ControlStyle.IsEmpty;
            if (need_span)
            {
#if NET_2_0
                AddDisplayStyleAttribute(w);
#endif
                ControlStyle.AddAttributesToRender(w, this);
            }

            bool enabled = IsEnabled;
            if (!enabled)
            {
                w.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled", false);
                need_span = true;
            }

            string tt = ToolTip;
            if (tt != null && tt.Length > 0)
            {
                w.AddAttribute("title", tt);
                need_span = true;
            }

#if NET_2_0
            if (HasAttributes && AddAttributesForSpan(w))
            {
                need_span = true;
            }
#else
            if (Attributes.Count > 0 && AddAttributesForSpan(w))
            {
                need_span = true;
            }
#endif

            if (need_span)
            {
                w.RenderBeginTag(HtmlTextWriterTag.Span);
            }

            TextAlign align = TextAlign;
            if (align == TextAlign.Right)
            {
                RenderInput(w, enabled);
                RenderLabel(w);
            }
            else
            {
                RenderLabel(w);
                RenderInput(w, enabled);
            }

            if (need_span)
            {
                w.RenderEndTag();
            }
        }
        public Vector2 DrawText(UniversalFont font, StringBuilder text, Rectangle target, TextAlign align, Color[] colors, float opacity, float spacing, float lineHeight, float scale)
        {
            if (font == null || text == null)
            {
                return(Vector2.Zero);
            }

            Font = font;

            Vector2 size     = _font.MeasureString(text, spacing, lineHeight) * scale;
            Vector2 position = TextPosition(ref target, align, size, TextRotation.None);

            if (_font.SitanaFont != null)
            {
                PrimitiveType = PrimitiveType.TriangleList;

                PrimitiveBatchNeeded();
                _font.SitanaFont.Draw(_primitiveBatch, text, position, colors, opacity, spacing, lineHeight, scale);
            }
            else
            {
                throw new Exception("Only Sitana Font supports colored text.");
            }

            return(size);
        }
示例#53
0
        public static Message ShowText(string s, TextAlign align, BordmonitorFields field, byte index = 0, bool isChecked = false, bool send = true)
        {
            int len;

            byte[] data;

            if (Translit)
            {
                s = s.Translit();
            }
            switch (field)
            {
            case BordmonitorFields.Title:
                len  = 11;
                data = DataShowTitle;
                break;

            case BordmonitorFields.Status:
                len  = 11;
                data = DataShowStatus;
                break;

            case BordmonitorFields.Item:
                if (isChecked)
                {
                    len = 15;
                }
                else
                {
                    switch (NaviVersion)
                    {
                    case Tools.NaviVersion.MK4:
                        len = System.Math.Min(23, s.Length);
                        break;

                    default:
                        len = 15;
                        break;
                    }
                }
                index += 0x40;

                /*if (index == 0x47)
                 * {
                 *  index = 0x7;
                 * }*/
                if (NaviVersion == Tools.NaviVersion.MK2)
                {
                    data = new byte[] { 0xA5, 0x62, 0x00, (byte)index };
                }
                else
                {
                    data = new byte[] { 0x21, 0x60, 0x00, (byte)index };
                }
                break;

            default:
                throw new Exception("TODO");
            }
            var offset = data.Length;

            data = data.PadRight(0x20, len);
            data.PasteASCII(Translit ? s : s.UTF8ToASCII(), offset, len);
            if (isChecked)
            {
                data[data.Length - 2] = 0x2A;
            }
            if (field == BordmonitorFields.Item && NaviVersion < Tools.NaviVersion.MK4)
            {
                data[data.Length - 1] = 0x06;
            }
            var m = new Message(iBus.DeviceAddress.Radio, iBus.DeviceAddress.GraphicsNavigationDriver, "Show message on BM (" + index.ToHex() + "): " + s, data);

            if (send)
            {
                Manager.EnqueueMessage(m);
            }
            return(m);
        }
 public Vector2 DrawText(UniversalFont font, StringBuilder text, Rectangle target, TextAlign align, Color[] colors, float opacity)
 {
     return(DrawText(font, text, target, align, colors, opacity, 0, 0, 1));
 }
示例#55
0
 public override double[] GetTextBounds(string txt, double x, double y, double size, double angle, TextAlign align)
 {
     return(MeasurePainter.GetTextBounds(txt, x, y, size, angle, align));
 }
 public Vector2 DrawText(UniversalFont font, StringBuilder text, Rectangle target, TextAlign align, Color color)
 {
     return(DrawText(font, text, target, align, color, 0, 0, 1, TextRotation.None));
 }
示例#57
0
        public static bool ReadBool(string optionalText = "", LineBreak lineBreak = None, TextAlign textAlign = Center)
        {
            Cc();
            while (true)
            {
                if (optionalText != "")
                {
                    Write(optionalText, lineBreak, textAlign);
                }

                if (textAlign == Center)
                {
                    var nbSpaces = (Console.WindowWidth - optionalText.Length) / 2;
                    Console.SetCursorPosition(nbSpaces, Console.CursorTop);
                }

                var input = Console.ReadKey().Key;

                if (input == ConsoleKey.O || input == ConsoleKey.N)
                {
                    switch (input)
                    {
                    case ConsoleKey.O:
                        return(true);

                    case ConsoleKey.N:
                        return(false);
                    }
                }
                else
                {
                    Write();
                    ErrorColors();
                    Write("  Error : the input is empty or non-compliant  ", Both, textAlign);
                    BaseColors();
                    Pause("retry");
                }
            }
        }
示例#58
0
 protected ExcelRange InsertParagraph(string value, int colOffset = 0, TextAlign AlignMode = TextAlign.LEFT, int mergeCols = 1, int?rowsOccuppied = null)
 {
     return(insertValue(value, "paragraph", colOffset, AlignMode, mergeCols: mergeCols, rowsOccuppied: rowsOccuppied));
 }
示例#59
0
 /// <summary>
 /// Displays the specified text within the specified rectangular region.
 /// </summary>
 /// <param name="text">The text to display.</param>
 /// <param name="x">The X coordinate of the rectangular region.</param>
 /// <param name="y">The Y coordinate of the rectangular region.</param>
 /// <param name="width">The width of the rectangular region.</param>
 /// <param name="height">The height of the rectangular region.</param>
 /// <param name="color">The text color.</param>
 /// <param name="font">The text font.</param>
 /// <param name="textAlignment">A value from the <see cref="TextAlign"/> enumeration that specifies how to align the text within the rectangular region.</param>
 public void DisplayTextInRectangle(string text, uint x, uint y, uint width, uint height, Color color, Font font, TextAlign textAlignment)
 {
     DisplayTextInRectangle(text, x, y, width, height, color, font, textAlignment, WordWrap.None, Trimming.WordEllipsis, ScaleText.None);
 }
示例#60
0
        public static int ReadInt(int?min, int?max, string optionalText = "", LineBreak lineBreak = None, TextAlign textAlign = Center)
        {
            Cc();
            int res;

            while (true)
            {
                if (optionalText != "")
                {
                    Write(optionalText, lineBreak, textAlign);
                }

                if (textAlign == Center)
                {
                    var nbSpaces = (Console.WindowWidth - optionalText.Length) / 2;
                    Console.SetCursorPosition(nbSpaces, Console.CursorTop);
                }

                if (int.TryParse(Console.ReadLine(), out res))
                {
                    ErrorColors();
                    if ((min == null && max == null) || (min != null && max != null && res >= min && res <= max) || (min == null && res <= max) || (max == null && res >= min))
                    {
                        BaseColors();
                        break;
                    }

                    if (min != null && res < min)
                    {
                        Write();
                        Write("  Error : the input should be at least " + min + "  ", Both, textAlign);
                        BaseColors();
                        Pause("retry");
                    }
                    else if (max != null && res > max)
                    {
                        Write();
                        Write("  Error : the input should be at most " + max + "  ", Both, textAlign);
                        BaseColors();
                        Pause("retry");
                    }
                    else
                    {
                        Write();
                        Write("  Error : the input should be between " + min + " and " + max + "  ", Both, textAlign);
                        BaseColors();
                        Pause("retry");
                    }
                }
                else
                {
                    Write();
                    ErrorColors();
                    Write("  Error : the input is empty, isn't an integer or is too big  ", Both, textAlign);
                    BaseColors();
                    Pause("retry");
                }
            }
            return(res);
        }