【问题标题】:C# print textbox with textC# 打印带有文本的文本框
【发布时间】:2015-01-24 09:45:35
【问题描述】:

我正在尝试模拟文本框风格的游戏口袋妖怪。我将句子读入 .txt 文件,当字符遇到文本框框架的边缘时,应该换行并继续书写。我正在尝试这种方法,但它不起作用。我知道你帮忙?

public void DrawTextBox()
{
    //CONTROLLO INPUT
    ConsoleKeyInfo key = Console.ReadKey(true);

    switch (key.Key)
    {
        case ConsoleKey.Spacebar:
            isPress = true;
            break;
    }

    //STAMPO
    if (isPress ==true)
    {
        for (i = 0; i < Height; i++)
        {
           Console.CursorTop = Offset.y + i;

            for (j = 0; j < Width; j++)
            {
                Console.CursorLeft = Offset.x + j;

                if (Console.CursorLeft == Width - Offset.x)
                {
                    Console.CursorTop+=1;
                    Console.CursorLeft = 0;
                }

                else
                    Console.Write(Dialog[i, j].Char);

                Thread.Sleep(200);
            }
        }
    }
}

【问题讨论】:

    标签: c# console cursor ascii offset


    【解决方案1】:

    为该文本框启用多行属性

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-12-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-08
      相关资源
      最近更新 更多