gpt4 book ai didi

c# - 是否可以使用 StreamWriter c# 水平附加文本?

转载 作者:行者123 更新时间:2023-11-30 18:34:21 26 4
gpt4 key购买 nike

我正在使用 Kinect 并且可以将跟踪坐标保存到文本文件中,但是我需要为每个 X 和 Y 坐标附加水平(从左到右)的文本以便绘制图形.目前文本看起来像这样:

2:58:22 PM

Head X 314

Head Y 250

2:58:22 PM

Head X 314

Head Y 251

但我正在尝试这样获取它:

2:58:22 PM               2:58:23 PM

Head X 1 2 3 4 5 6 7 8 9

Head Y 1 2 3 4 5 6 7 8 9

这是我保存到文本文件的代码:

StreamWriter sw = File.AppendText("Text.txt");
sw.WriteLine(DateTime.Now.ToLongTimeString());

sw.WriteLine("Head X " + "\t" + TextBox21.Text);
sw.WriteLine("Head Y " + "\t" + TextBox41.Text);

sw.WriteLine("Shoulder X" + "\t" + TextBox22.Text);
sw.WriteLine("Shoulder Y" + "\t" + TextBox42.Text);

sw.WriteLine("ShoulderLeft X" + "\t" + TextBox23.Text);
sw.WriteLine("ShoulderLeft Y" + "\t" + TextBox43.Text);

sw.WriteLine("ShoulderRight X" + "\t" + TextBox24.Text);
sw.WriteLine("ShoulderRight Y" + "\t" + TextBox44.Text);

sw.WriteLine("ElbowLeft X" + "\t" + TextBox25.Text);
sw.WriteLine("ElbowLeft Y" + "\t" + TextBox45.Text);

sw.WriteLine("ElbowRight X" + "\t" + TextBox26.Text);
sw.WriteLine("ElbowRight Y" + "\t" + TextBox46.Text);

sw.WriteLine("WristLeft X" + "\t" + TextBox27.Text);
sw.WriteLine("WristLeft Y" + "\t" + TextBox47.Text);

sw.WriteLine("WristRight X" + "\t" + TextBox28.Text);
sw.WriteLine("WristRight Y" + "\t" + TextBox48.Text);

sw.WriteLine("HandLeft X" + "\t" + TextBox29.Text);
sw.WriteLine("HandLeft Y" + "\t" + TextBox49.Text);

sw.WriteLine("HandRight X" + "\t" + TextBox30.Text);
sw.WriteLine("HandRight Y" + "\t" + TextBox50.Text);

sw.WriteLine("Spine X " + "\t" + TextBox31.Text);
sw.WriteLine("Spine Y " + "\t" + TextBox51.Text);

sw.WriteLine("HipCenter X" + "\t" + TextBox32.Text);
sw.WriteLine("HipCenter Y" + "\t" + TextBox52.Text);

sw.WriteLine("HipLeft X" + "\t" + TextBox33.Text);
sw.WriteLine("HipLeft Y" + "\t" + TextBox53.Text);

sw.WriteLine("HipRight X" + "\t" + TextBox34.Text);
sw.WriteLine("HipRight Y" + "\t" + TextBox54.Text);

sw.WriteLine("KneeLeft X" + "\t" + TextBox35.Text);
sw.WriteLine("KneeLeft Y" + "\t" + TextBox55.Text);

sw.WriteLine("KneeRight X" + "\t" + TextBox36.Text);
sw.WriteLine("KneeRight Y" + "\t" + TextBox56.Text);

sw.WriteLine("AnkleLeft X" + "\t" + TextBox37.Text);
sw.WriteLine("AnkleLeft Y" + "\t" + TextBox57.Text);

sw.WriteLine("AnkleRight X" + "\t" + TextBox38.Text);
sw.WriteLine("AnkleRight Y" + "\t" + TextBox58.Text);

sw.WriteLine("FootLeft X" + "\t" + TextBox39.Text);
sw.WriteLine("FootLeft Y" + "\t" + TextBox59.Text);

sw.WriteLine("FootRight X" + "\t" + TextBox40.Text);
sw.WriteLine("FootRight Y" + "\t" + TextBox60.Text);

sw.Close();

最佳答案

sw.Write 将允许您编写内联文本。

WriteLine 创建换行符。

关于c# - 是否可以使用 StreamWriter c# 水平附加文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16195312/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com