|
-
September 8th, 2008, 11:14 AM
#1
start the console in fullscreen mode! and some other newbie questions.
Hi, Im new here. Call me alexandergre and Im 17 from Sweden. Natural-science student. We are programming with C# but only with console apps (just for now)
My questions:
1.A code which makes the console run in fullscreen. I have played around with SetWindowsSize but didnt succeed to make it fullscreen!
2.
Console.Write("Password: ");
string pass = Console.ReadLine();
I dont want the password to be visible when Im typing it! I want it to be stars or dots!
thank you very much!
/ this is not a homework. I am just extra working on a project for my self!
-
September 8th, 2008, 01:11 PM
#2
Re: start the console in fullscreen mode! and some other newbie questions.
1. you can make the size of the console window equal to the size of the screen. Use the System.Windows.Forms.Screen class.
2. you can catch each character that is typed, store it, and replace it on the screen with a '*'
-
September 8th, 2008, 03:05 PM
#3
Re: start the console in fullscreen mode! and some other newbie questions.
 Originally Posted by eclipsed4utoo
1. you can make the size of the console window equal to the size of the screen. Use the System.Windows.Forms.Screen class.
2. you can catch each character that is typed, store it, and replace it on the screen with a '*'
System.Windows.Forms.Screen is for windows application. You can use the Console.Width and Console.Height properties instead.
-
September 9th, 2008, 06:08 AM
#4
Re: start the console in fullscreen mode! and some other newbie questions.
Using Console.Readline you will not get your input hidden. I never tried to do this in a Console application, this is normally done in Windows.forms application. Maybe you can use something which catches every single sign. Last time I did this was 30 years ago in an old non windows C application There we used getch as much as I remember. Maybe this is still working ? Then we overwrite the output with an asterix. This was quick enough to net be seen on the screen.
 Jonny Poet
To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
If anyone felt he has got help, show it in rating the post.
Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
My latest articles :
Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7
-
September 9th, 2008, 07:08 AM
#5
Re: start the console in fullscreen mode! and some other newbie questions.
Taken from msdn:
Code:
Console.WriteLine(" Enter username:");
string username = Console.ReadLine();
Console.WriteLine(" Enter password:");
string password = "";
ConsoleKeyInfo info = Console.ReadKey(true);
while (info.Key != ConsoleKey.Enter)
{
if (info.Key != ConsoleKey.Backspace)
{
password += info.KeyChar;
info = Console.ReadKey(true);
}
else if (info.Key == ConsoleKey.Backspace)
{
if (!string.IsNullOrEmpty(password))
{
password = password.Substring
(0, password.Length - 1);
}
info = Console.ReadKey(true);
}
}
for (int i = 0; i < password.Length; i++)
Console.Write("*");
It's not a bug, it's a feature!
-
September 9th, 2008, 07:34 AM
#6
Re: start the console in fullscreen mode! and some other newbie questions.
 Originally Posted by Talikag
System.Windows.Forms.Screen is for windows application. You can use the Console.Width and Console.Height properties instead.
aren't Console.Width and Console.Height the size of the console window? I was telling him that he could use System.Windows.Forms.Screen to get the height and width of the client screen, then set the height and width of the console window to those values.
-
September 9th, 2008, 01:08 PM
#7
Re: start the console in fullscreen mode! and some other newbie questions.
Thank you very much foamy! TACK!
jag e från sverige!
thanks guys! : D
-
September 9th, 2008, 03:36 PM
#8
Re: start the console in fullscreen mode! and some other newbie questions.
alexandergre, "fullscreening" a Console window cannot be done, sorry
Last edited by dahwan; September 9th, 2008 at 03:38 PM.
Please vote the posts you find usefull.
---
I'm back
Bigger and badder
Better and bolder
Explaining stuff -
With an improved vocabulary!
-
September 9th, 2008, 07:17 PM
#9
Re: start the console in fullscreen mode! and some other newbie questions.
 Originally Posted by dahwan
alexandergre, "fullscreening" a Console window cannot be done, sorry 
Its Ok. - long ago - People changes welcome back
 Jonny Poet
To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
If anyone felt he has got help, show it in rating the post.
Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
My latest articles :
Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|