开发者

Need an example about console application which user can interact console window

I need write a console application like as hiren boot screen: alt text http://xahoithongtin.com.vn/Images/diembao/2006_10/Hir开发者_如何学Pythonen2.jpg

User can input a arrow key or a number for choosing. When a menu item is selected, I will fill a background for the selected menu item.

Please give me some guideline or example. Thanks.


The console class has all the core functionality you need.

To set the cursor to any desired position you can use the Console.CursorLeft or Console.CursorTop properties. A little example is already posted here.

For the colors you can use the Console.BackgroundColor and Console.ForegroundColor.

With these properties you should be able to write all this stuff onto the screen. Afterwards you need to check the user input (KeyUp, KeyDown pressed). This can be done by checking the result of Console.ReadKey() method. By setting the boolean paramter to true you can prevent that the pressed character is displayed on the screen itself.

With this base functionality you should be able to write your own helper class to make all this stuff a little more comfortable.


There are several .NET based NCurses libraries around that make creation of console based interfaces easier:

  • Curses#
  • MonoCurses
  • CursesSharp
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜