更新CMD中现有文本的颜色?
我正在使用2D数组在命令行中显示sudoku网格,我想更改用户通过箭头键选择的数字的颜色。除了突出显示部分,我还有一切。
有没有办法在2D数组中更改所选数字的颜色? 还是还有其他更有效的方法?
I am using a 2D array to display Sudoku grids in command line and I want to change the colour of a number which is selected by the user through arrow keys. I have everything except the highlighting part.
Is there a way to change the colour of a selected number in a 2d array?
Or would there be some other, more efficient way of doing that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您想要这样的效果,
然后您必须在图纸例程中处理它。
上面的示例是用
完成的,如果(i == rowcurrent&&&&& j == colcurrent)
line> line分支以突出显示的单元格在写出文本之前更改显示颜色。If you want an effect like this
then you have to handle it in the drawing routine.
The example above is done with
The
if (i == rowCurrent && j == colCurrent)
line branches off for the highlighted cell changing the display colors before writing the text out.谢谢大家的输入,我找到了解决方案:
并不高效,看起来很丑陋,但效果很好。
抱歉,我无法共享代码。
Thank you all for your input, I have found the solution:
Its not efficient and looks ugly but it works well.
Sorry I couldn't share the code.