示例#1
0
        /// <summary>
        /// Writes text to the display in the specified row.
        /// </summary>
        /// <param name="row">
        /// The row to write the text in.
        /// </param>
        /// <param name="data">
        /// The text string to write.
        /// </param>
        /// <param name="alignment">
        /// The text alignment within the row.
        /// </param>
        /// <exception cref="InvalidOperationException">
        /// The row or column index is invalid for the display.
        /// </exception>
        public void Write(Int32 row, String data, LcdTextAlignment alignment)
        {
            Int32 columnIndex = 0;

            if ((alignment != LcdTextAlignment.Left) && (data.Length < this.ColumnCount))
            {
                Int32 remaining = (this.ColumnCount - data.Length);
                if (alignment == LcdTextAlignment.Right)
                {
                    columnIndex = remaining;
                }
                else if (alignment == LcdTextAlignment.Center)
                {
                    columnIndex = (remaining / 2);
                }
            }
            this.Write(row, columnIndex, data);
        }
示例#2
0
        /// <summary>
        /// Write the specified data to the display.
        /// </summary>
        /// <param name="row">
        /// The row to position the data in.
        /// </param>
        /// <param name="data">
        /// The string reperesentation of the data to write.
        /// </param>
        /// <param name="alignment">
        /// The text alignment.
        /// </param>
        /// <exception cref="InvalidOperationException">
        /// The row or column index is invalid for the display.
        /// </exception>
        public void WriteLine(Int32 row, String data, LcdTextAlignment alignment)
        {
            String result = data;

            if (data.Length < this.ColumnCount)
            {
                switch (alignment)
                {
                case LcdTextAlignment.Left:
                    result = StringUtils.PadRight(data, (this.ColumnCount - data.Length));
                    break;

                case LcdTextAlignment.Right:
                    result = StringUtils.PadLeft(data, (this.ColumnCount - data.Length));
                    break;

                case LcdTextAlignment.Center:
                    result = StringUtils.PadCenter(data, this.ColumnCount);
                    break;
                }
            }
            this.Write(row, 0, result);
        }
示例#3
0
 /// <summary>
 /// Write the specified data to the display.
 /// </summary>
 /// <param name="row">
 /// The row to position the data in.
 /// </param>
 /// <param name="alignment">
 /// The text alignment within the row.
 /// </param>
 /// <param name="args">
 /// The arguments.
 /// </param>
 /// <param name="data">
 /// The text to write to the display.
 /// </param>
 /// <exception cref="InvalidOperationException">
 /// The row or column index is invalid for the display.
 /// </exception>
 public void WriteLine(Int32 row, String data, LcdTextAlignment alignment, Object args)
 {
     this.WriteLine(row, String.Format(data, args), alignment);
 }
示例#4
0
 /// <summary>
 /// Write the specified data to the display.
 /// </summary>
 /// <param name="row">
 /// The row to position the data in.
 /// </param>
 /// <param name="alignment">
 /// The text alignment within the row.
 /// </param>
 /// <param name="args">
 /// The arguments.
 /// </param>
 /// <param name="data">
 /// The text to write to the display.
 /// </param>
 /// <exception cref="InvalidOperationException">
 /// The row or column index is invalid for the display.
 /// </exception>
 public void WriteLine(Int32 row, String data, LcdTextAlignment alignment, Object args)
 {
     this.WriteLine(row, String.Format(data, args), alignment);
 }
示例#5
0
 /// <summary>
 /// Write the specified data to the display.
 /// </summary>
 /// <param name="row">
 /// The row to position the data in.
 /// </param>
 /// <param name="data">
 /// The string reperesentation of the data to write.
 /// </param>
 /// <param name="alignment">
 /// The text alignment.
 /// </param>
 /// <exception cref="InvalidOperationException">
 /// The row or column index is invalid for the display.
 /// </exception>
 public void WriteLine(Int32 row, String data, LcdTextAlignment alignment)
 {
     String result = data;
     if (data.Length < this.ColumnCount) {
         switch (alignment) {
             case LcdTextAlignment.Left:
                 result = StringUtils.PadRight(data, (this.ColumnCount - data.Length));
                 break;
             case LcdTextAlignment.Right:
                 result = StringUtils.PadLeft(data, (this.ColumnCount - data.Length));
                 break;
             case LcdTextAlignment.Center:
                 result = StringUtils.PadCenter(data, this.ColumnCount);
                 break;
         }
     }
     this.Write(row, 0, result);
 }
示例#6
0
 /// <summary>
 /// Writes text to the display in the specified row.
 /// </summary>
 /// <param name="row">
 /// The row to write the text in.
 /// </param>
 /// <param name="data">
 /// The text string to write.
 /// </param>
 /// <param name="alignment">
 /// The text alignment within the row.
 /// </param>
 /// <exception cref="InvalidOperationException">
 /// The row or column index is invalid for the display.
 /// </exception>
 public void Write(Int32 row, String data, LcdTextAlignment alignment)
 {
     Int32 columnIndex = 0;
     if ((alignment != LcdTextAlignment.Left) && (data.Length < this.ColumnCount)) {
         Int32 remaining = (this.ColumnCount - data.Length);
         if (alignment == LcdTextAlignment.Right) {
             columnIndex = remaining;
         }
         else if (alignment == LcdTextAlignment.Center) {
                 columnIndex = (remaining / 2);
         }
     }
     this.Write(row, columnIndex, data);
 }