[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

Why is my Console Application limiting itself to half the screen?

Nathan Sokalski

10/28/2008 9:48:00 PM

I have a Console Application, and when I do a "Start Without Debugging" to
test it, everything works, but it will not allow me to make the window wider
than half my screen. Even if I maximize it, it takes the full height, but
only half the width. This is very annoying, because sometimes lines are
longer than half the screen. Why is this, and is there any way to allow me
to make it take up the whole screen? Thanks.
--
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansok...


11 Answers

Family Tree Mike

10/28/2008 9:55:00 PM

0

Change the window properties to 132 columns. The width is probably maxed
out at 80 columns.

"Nathan Sokalski" <njsokalski@hotmail.com> wrote in message
news:e1H5fbUOJHA.4752@TK2MSFTNGP04.phx.gbl...
>I have a Console Application, and when I do a "Start Without Debugging" to
>test it, everything works, but it will not allow me to make the window
>wider than half my screen. Even if I maximize it, it takes the full height,
>but only half the width. This is very annoying, because sometimes lines are
>longer than half the screen. Why is this, and is there any way to allow me
>to make it take up the whole screen? Thanks.
> --
> Nathan Sokalski
> njsokalski@hotmail.com
> http://www.nathansok...
>

Nathan Sokalski

10/28/2008 10:29:00 PM

0

Where would I go to change this?
--
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansok...

"Family Tree Mike" <FamilyTreeMike@ThisOldHouse.com> wrote in message
news:On1VFfUOJHA.3472@TK2MSFTNGP04.phx.gbl...
> Change the window properties to 132 columns. The width is probably maxed
> out at 80 columns.
>
> "Nathan Sokalski" <njsokalski@hotmail.com> wrote in message
> news:e1H5fbUOJHA.4752@TK2MSFTNGP04.phx.gbl...
>>I have a Console Application, and when I do a "Start Without Debugging" to
>>test it, everything works, but it will not allow me to make the window
>>wider than half my screen. Even if I maximize it, it takes the full
>>height, but only half the width. This is very annoying, because sometimes
>>lines are longer than half the screen. Why is this, and is there any way
>>to allow me to make it take up the whole screen? Thanks.
>> --
>> Nathan Sokalski
>> njsokalski@hotmail.com
>> http://www.nathansok...
>>
>


Family Tree Mike

10/28/2008 10:48:00 PM

0

Right click on the console window's title bar and select properties. It
should be on the layout tab, shown as window size.

"Nathan Sokalski" <njsokalski@hotmail.com> wrote in message
news:uVmRjyUOJHA.4372@TK2MSFTNGP04.phx.gbl...
> Where would I go to change this?
> --
> Nathan Sokalski
> njsokalski@hotmail.com
> http://www.nathansok...
>
> "Family Tree Mike" <FamilyTreeMike@ThisOldHouse.com> wrote in message
> news:On1VFfUOJHA.3472@TK2MSFTNGP04.phx.gbl...
>> Change the window properties to 132 columns. The width is probably maxed
>> out at 80 columns.
>>
>> "Nathan Sokalski" <njsokalski@hotmail.com> wrote in message
>> news:e1H5fbUOJHA.4752@TK2MSFTNGP04.phx.gbl...
>>>I have a Console Application, and when I do a "Start Without Debugging"
>>>to test it, everything works, but it will not allow me to make the window
>>>wider than half my screen. Even if I maximize it, it takes the full
>>>height, but only half the width. This is very annoying, because sometimes
>>>lines are longer than half the screen. Why is this, and is there any way
>>>to allow me to make it take up the whole screen? Thanks.
>>> --
>>> Nathan Sokalski
>>> njsokalski@hotmail.com
>>> http://www.nathansok...
>>>
>>
>
>

Family Tree Mike

10/29/2008 10:41:00 AM

0

That feature is no longer availabe in Vista.

"å¼ å??鹏" wrote:

> alt + enter to solve the problem.
>

Stanimir Stoyanov

10/29/2008 10:48:00 AM

0

In addition to what Mike suggested, you can set the window Width and Height
of your Console at start up:

Console.WindowWidth = Console.LargestWindowWidth
Console.WindowHeight = Console.LargestWindowHeight

This will ensure that your Console takes up the whole working area and is
similar to what PowerShell does.

--
Stanimir Stoyanov
http://stoy...

"Nathan Sokalski" <njsokalski@hotmail.com> wrote in message
news:e1H5fbUOJHA.4752@TK2MSFTNGP04.phx.gbl...
>I have a Console Application, and when I do a "Start Without Debugging" to
>test it, everything works, but it will not allow me to make the window
>wider than half my screen. Even if I maximize it, it takes the full height,
>but only half the width. This is very annoying, because sometimes lines are
>longer than half the screen. Why is this, and is there any way to allow me
>to make it take up the whole screen? Thanks.
> --
> Nathan Sokalski
> njsokalski@hotmail.com
> http://www.nathansok...
>

sloan

10/29/2008 1:57:00 PM

0

That trick ROCKS!

I altered slightly, to get 90%

Console.WindowWidth = (Console.LargestWindowWidth * 9 / 10);

Console.WindowHeight = (Console.LargestWindowHeight * 9 / 10);



Thanks!!

"Stanimir Stoyanov" <stoyanov@REMOVETHIS.live.com> wrote in message
news:2E4DF843-5854-470C-9216-D063575E5AAE@microsoft.com...
> In addition to what Mike suggested, you can set the window Width and
> Height of your Console at start up:
>
> Console.WindowWidth = Console.LargestWindowWidth
> Console.WindowHeight = Console.LargestWindowHeight
>
> This will ensure that your Console takes up the whole working area and is
> similar to what PowerShell does.
>
> --
> Stanimir Stoyanov
> http://stoy...
>
> "Nathan Sokalski" <njsokalski@hotmail.com> wrote in message
> news:e1H5fbUOJHA.4752@TK2MSFTNGP04.phx.gbl...
>>I have a Console Application, and when I do a "Start Without Debugging" to
>>test it, everything works, but it will not allow me to make the window
>>wider than half my screen. Even if I maximize it, it takes the full
>>height, but only half the width. This is very annoying, because sometimes
>>lines are longer than half the screen. Why is this, and is there any way
>>to allow me to make it take up the whole screen? Thanks.
>> --
>> Nathan Sokalski
>> njsokalski@hotmail.com
>> http://www.nathansok...
>>
>


Mythran

10/29/2008 3:51:00 PM

0



"sloan" <sloan@ipass.net> wrote in message
news:#XHjX4cOJHA.4328@TK2MSFTNGP02.phx.gbl...
> That trick ROCKS!
>
> I altered slightly, to get 90%
>
> Console.WindowWidth = (Console.LargestWindowWidth * 9 / 10);
>
> Console.WindowHeight = (Console.LargestWindowHeight * 9 / 10);
>
>
>

Or you could have used:

Console.WindowWidth = Console.LargestWindowWidth * 0.9
Console.WindowHeight = Console.LargestWindowHeight * 0.9

:D It's math. Multiple ways to do the same thing :)


hth,
Mythran


sloan

10/29/2008 6:41:00 PM

0


You should have tested your code dude:

Error 1 Cannot implicitly convert type 'double' to 'int'. An explicit
conversion exists (are you missing a cast?)

That's where I came up with the * 9 / 10 ...




"Mythran" <Mythran@community.nospam> wrote in message
news:7F2804D3-EFA4-4D53-B352-5E221BAA4FB0@microsoft.com...
>
>
> "sloan" <sloan@ipass.net> wrote in message
> news:#XHjX4cOJHA.4328@TK2MSFTNGP02.phx.gbl...
>> That trick ROCKS!
>>
>> I altered slightly, to get 90%
>>
>> Console.WindowWidth = (Console.LargestWindowWidth * 9 / 10);
>>
>> Console.WindowHeight = (Console.LargestWindowHeight * 9 / 10);
>>
>>
>>
>
> Or you could have used:
>
> Console.WindowWidth = Console.LargestWindowWidth * 0.9
> Console.WindowHeight = Console.LargestWindowHeight * 0.9
>
> :D It's math. Multiple ways to do the same thing :)
>
>
> hth,
> Mythran
>
>


Michael B. Trausch

10/29/2008 11:20:00 PM

0

On Wed, 29 Oct 2008 08:51:18 -0700
"Mythran" <Mythran@community.nospam> wrote:

> Console.WindowWidth = Console.LargestWindowWidth * 0.9
> Console.WindowHeight = Console.LargestWindowHeight * 0.9

I think you meant to say:

Console.WindowWidth =
(int)Math.Round((double)Console.LargestWindowWidth*0.9);
Console.WindowHeight =
(int)Math.Round((double)Console.LargestWindowHeight*0.9);

Since Console.Window{Width,Height} are integers. Though, concise this
is not.

Also, it's not very portable; Windows is the only system where the
"console" has any notion of how large it can become on the given
display. Every other operating system uses terminal emulation instead
of a dedicated console, and thus it's maximum width/height is whatever
the user says is going to be, period, so these methods will return the
current size of the terminal on non-Windows systems.

--- Mike

--
My sigfile ran away and is on hiatus.
http://www.t...

Michael B. Trausch

10/30/2008 12:32:00 AM

0

On Wed, 29 Oct 2008 19:19:36 -0400
"Michael B. Trausch" <mike@trausch.us> wrote:

> Also, it's not very portable; Windows is the only system where the
> "console" has any notion of how large it can become on the given
> display.

Furthermore (I should have mentioned this in my last post), setting the
Console width and height will throw System.NotSupportedException on
non-Windows platforms, i.e., using Mono. Not sure what Microsoft's
Rotor does on non-Windows platforms, but I suspect it would do the same
thing since there is no way to change the terminal size without the
user doing it manually.

--- Mike

--
My sigfile ran away and is on hiatus.
http://www.t...