• <bdo id='6diMs'></bdo><ul id='6diMs'></ul>

      <i id='6diMs'><tr id='6diMs'><dt id='6diMs'><q id='6diMs'><span id='6diMs'><b id='6diMs'><form id='6diMs'><ins id='6diMs'></ins><ul id='6diMs'></ul><sub id='6diMs'></sub></form><legend id='6diMs'></legend><bdo id='6diMs'><pre id='6diMs'><center id='6diMs'></center></pre></bdo></b><th id='6diMs'></th></span></q></dt></tr></i><div id='6diMs'><tfoot id='6diMs'></tfoot><dl id='6diMs'><fieldset id='6diMs'></fieldset></dl></div>

    1. <legend id='6diMs'><style id='6diMs'><dir id='6diMs'><q id='6diMs'></q></dir></style></legend>

        <tfoot id='6diMs'></tfoot>

        <small id='6diMs'></small><noframes id='6diMs'>

      1. 如何在 C# 控制台应用程序中绘制方框、矩形

        How to Draw Box,Rectangle in a C# Console application(如何在 C# 控制台应用程序中绘制方框、矩形)

          <legend id='gNcTJ'><style id='gNcTJ'><dir id='gNcTJ'><q id='gNcTJ'></q></dir></style></legend>

              1. <i id='gNcTJ'><tr id='gNcTJ'><dt id='gNcTJ'><q id='gNcTJ'><span id='gNcTJ'><b id='gNcTJ'><form id='gNcTJ'><ins id='gNcTJ'></ins><ul id='gNcTJ'></ul><sub id='gNcTJ'></sub></form><legend id='gNcTJ'></legend><bdo id='gNcTJ'><pre id='gNcTJ'><center id='gNcTJ'></center></pre></bdo></b><th id='gNcTJ'></th></span></q></dt></tr></i><div id='gNcTJ'><tfoot id='gNcTJ'></tfoot><dl id='gNcTJ'><fieldset id='gNcTJ'></fieldset></dl></div>
                  <bdo id='gNcTJ'></bdo><ul id='gNcTJ'></ul>
                • <tfoot id='gNcTJ'></tfoot>

                  <small id='gNcTJ'></small><noframes id='gNcTJ'>

                    <tbody id='gNcTJ'></tbody>
                  本文介绍了如何在 C# 控制台应用程序中绘制方框、矩形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我问了两个相关的问题.

                  I ask for 2 related questions.

                  1-我们如何将输出(例如结果和消息)放入 c# 控制台应用程序的框内.

                  1-How we can Put outputs(such as Results and Messages) inside a box in a c# console application.

                  2-我们如何在 c# 控制台应用程序中绘制矩形.感谢您提供任何示例教程或建议

                  2-How we can draw rectangle in a c# console application.thank u for any sample tutorial or advice

                  推荐答案

                  假设你的意思是一个字符框,这就可以了.

                  Assuming you just meant a character box this will do it.

                   private static void DrawABox( int x, int y, int width, int height,char Edge,string Message )
                      {
                          int LastIndex =0 ;
                          Console.SetCursorPosition(x, y);
                          for ( int h_i = 0; h_i <= height ; h_i++ )
                          {
                              if ( LastIndex != -1 )
                              {
                                  int seaindex = (LastIndex + ( width - 1) );
                                  if(seaindex >= Message.Length -1 )
                                      seaindex = Message.Length - 1;
                                  int newIndex = Message.LastIndexOf(' ',seaindex);
                                  if(newIndex == -1 )
                                      newIndex = Message.Length - 1;
                                  string substr = Message.Substring(LastIndex, newIndex - LastIndex);
                                  LastIndex = newIndex;
                                  Console.SetCursorPosition(x + 1, y + h_i);
                                  Console.Write(substr);
                              }
                              for ( int w_i = 0; w_i <= width; w_i++ )
                              {
                  
                                  if ( h_i % height == 0 || w_i % width == 0 )
                                  {
                                      Console.SetCursorPosition(x + w_i, y + h_i);
                                      Console.Write(Edge);
                                  }
                  
                  
                              }
                  
                          }
                  

                  我编辑了代码以在其中添加一条消息.您将需要在边界条件上做更多的工作.例如,消息中没有空格,一个比方框长的词,但这应该足以让你开始.

                  I edited the code to put a message in their. You will need to do more work on the boundary conditions. Ex no space in the message a word that is longer then the box but this should be enough to get you started.

                  这篇关于如何在 C# 控制台应用程序中绘制方框、矩形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  C# namespace alias - what#39;s the point?(C# 命名空间别名 - 有什么意义?)
                  Using Xpath With Default Namespace in C#(在 C# 中使用具有默认命名空间的 Xpath)
                  Generating an EDMX from a DB2 Database(从 DB2 数据库生成 EDMX)
                  IBM .NET Data Provider Connection String issue with Library List(库列表的 IBM .NET 数据提供程序连接字符串问题)
                  .NET DB2 OLEDB pre-requisites(.NET DB2 OLEDB 先决条件)
                  Referring to Code in IBM.Data.DB2 makes that Assembly Unavailable to the rest of my Solution(引用 IBM.Data.DB2 中的代码使该程序集对我的解决方案的其余部分不可用)

                    1. <small id='rjzx2'></small><noframes id='rjzx2'>

                    2. <legend id='rjzx2'><style id='rjzx2'><dir id='rjzx2'><q id='rjzx2'></q></dir></style></legend>
                        <tbody id='rjzx2'></tbody>
                        <bdo id='rjzx2'></bdo><ul id='rjzx2'></ul>

                            <tfoot id='rjzx2'></tfoot>

                            <i id='rjzx2'><tr id='rjzx2'><dt id='rjzx2'><q id='rjzx2'><span id='rjzx2'><b id='rjzx2'><form id='rjzx2'><ins id='rjzx2'></ins><ul id='rjzx2'></ul><sub id='rjzx2'></sub></form><legend id='rjzx2'></legend><bdo id='rjzx2'><pre id='rjzx2'><center id='rjzx2'></center></pre></bdo></b><th id='rjzx2'></th></span></q></dt></tr></i><div id='rjzx2'><tfoot id='rjzx2'></tfoot><dl id='rjzx2'><fieldset id='rjzx2'></fieldset></dl></div>