C#可以设置控制台应用程序的滚动位置 [英] C# is there a way to set the scroll position of a console application

查看:63
本文介绍了C#可以设置控制台应用程序的滚动位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在这个问题上搜索了很长时间了,但是找不到关于如何执行此操作的任何结果。我目前有一个选择菜单,用户可以从中选择选项列表,该菜单从顶部开始,但是每次刷新列表时,窗口都会显示最后一个选项。我要做的就是能够在窗口中显示带有选定选项的行。

Hi I have been Googling this question for quite a while and cant find any results on how I would go about doing this. I currently have a selection menu that the user can select a list of options from and this starts at the top but the window displays the last options each time I refresh the list. All I want to do is be able to display the line with the selected option on in the window.

任何想法都会受到赞赏。

any ideas will be appreciated.

推荐答案

这是我最后使用的方法,它按我的意愿工作。

This is what I used in the end and it worked as I wanted it to.

Console.SetWindowPosition(0 , currentItem);

这篇关于C#可以设置控制台应用程序的滚动位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆