Beispiel #1
0
        //{ PrintFlush(force, false); }
        //public void PrintFlush(bool force, bool temporary)
        /// <summary>
        /// 
        /// </summary>
        /// <param name="force">バッファーが空のとき改行する</param>
        public void PrintFlush(bool force)
        {
            if (!this.Enabled)
                return;
            if (!force && printBuffer.IsEmpty)
                return;
            if (force && printBuffer.IsEmpty)
                printBuffer.Append(" ", Style);

            StringMeasure stringMeasure = new StringMeasure(getGraphics(), this.bgColor, Config.TextDrawingMode);
            ConsoleDisplayLine[] dispList = printBuffer.Flush(stringMeasure, force_temporary);
            //ConsoleDisplayLine[] dispList = printBuffer.Flush(stringMeasure, temporary | force_temporary);
            stringMeasure.Dispose();
            addRangeDisplayLine(dispList);
            RefreshStrings(false);
        }
Beispiel #2
0
 public string getStBar(string barStr)
 {
     StringMeasure stringMeasure = new StringMeasure(getGraphics(), this.bgColor, Config.TextDrawingMode);
     StringBuilder bar = new StringBuilder();
     bar.Append(barStr);
     int width = 0;
     while (width < window.MainPicBox.Width)
     {//境界を越えるまで一文字ずつ増やす
         bar.Append(barStr);
         width = stringMeasure.GetDisplayLength(bar.ToString(), Config.Font);
     }
     while (width > window.MainPicBox.Width)
     {//境界を越えたら、今度は超えなくなるまで一文字ずつ減らす(barStrに複数字の文字列がきた場合に対応するため)
         bar.Remove(bar.Length - 1, 1);
         width = stringMeasure.GetDisplayLength(bar.ToString(), Config.Font);
     }
     stringMeasure.Dispose();
     return bar.ToString();
 }
Beispiel #3
0
        private string CreateTypeCString(string str, bool alignmentRight)
        {
            StringMeasure stringMeasure = new StringMeasure(getGraphics(), this.bgColor, Config.TextDrawingMode);
            if (printCWidth == -1)
                calcPrintCWidth(stringMeasure);
            int length = 0;
            int width = 0;
            if (str != null)
                length = Config.Encode.GetByteCount(str);
            int printcLength = Config.PrintCLength;
            Font font = new Font(Style.Fontname, Config.Font.Size, Style.FontStyle, GraphicsUnit.Pixel);

            if ((alignmentRight) && (length < printcLength))
            {
                str = new string(' ', printcLength - length) + str;
                width = stringMeasure.GetDisplayLength(str, font);
                while (width > printCWidth)
                {
                    if (str[0] != ' ')
                        break;
                    str = str.Remove(0, 1);
                    width = stringMeasure.GetDisplayLength(str, font);
                }
            }
            else if ((!alignmentRight) && (length < printcLength + 1))
            {
                str += new string(' ', printcLength + 1 - length);
                width = stringMeasure.GetDisplayLength(str, font);
                while (width > printCWidthL)
                {
                    if (str[str.Length - 1] != ' ')
                        break;
                    str = str.Remove(str.Length - 1, 1);
                    width = stringMeasure.GetDisplayLength(str, font);
                }
            }
            stringMeasure.Dispose();
            return str;
        }
Beispiel #4
0
 public ConsoleDisplayLine BufferToSingleLine(bool force, bool temporary)
 {
     if (!this.Enabled)
         return null;
     if (!force && printBuffer.IsEmpty)
         return null;
     if (force && printBuffer.IsEmpty)
         printBuffer.Append(" ", Style);
     StringMeasure stringMeasure = new StringMeasure(getGraphics(), this.bgColor, Config.TextDrawingMode);
     ConsoleDisplayLine dispLine = printBuffer.FlushSingleLine(stringMeasure, temporary | force_temporary);
     stringMeasure.Dispose();
     return dispLine;
 }
Beispiel #5
0
 internal ConsoleDisplayLine PrintPlainwithSingleLine(string str)
 {
     if (!this.Enabled)
         return null;
     if (string.IsNullOrEmpty(str))
         return null;
     printBuffer.AppendPlainText(str, Style);
     StringMeasure stringMeasure = new StringMeasure(getGraphics(), this.bgColor, Config.TextDrawingMode);
     ConsoleDisplayLine dispLine = printBuffer.FlushSingleLine(stringMeasure, false);
     stringMeasure.Dispose();
     return dispLine;
 }