goblinfactory / konsole

Home of the simple console library consisting of ProgressBar, Window, Form, Draw & MockConsole (C# console progress bar with support for single or multithreaded progress updates) Window is a 100%-ish console compatible window, supporting all normal console writing to a windowed section of the screen, supporting scrolling and clipping of console output.
719 stars 62 forks source link

How to prevent console from being moved by user? Snap windows feature is changing size of Console. #91

Open haseakash opened 2 years ago

haseakash commented 2 years ago

im facing big issue with console app using c# core 2.0.

I still dident find any right aswer to lock console window position. It is movable by the user.

Main problem is if user move console window to any corner of current resolution then console changing its original size even if i set fixed size in program my certain Text are showing bad after changing cmd size.

i need a real solution for console app.

please help somebody

goblinfactory commented 2 years ago

Hi Haseakash

On Windows, you can use

   new PlatformStuff().LockResizing(width, height);

Or you can use a HighSpeedwriter, which will automatically lock the screen and it calls the code above in the constructor, as can be seen here;

https://github.com/goblinfactory/konsole/blob/45b69b422d8d9102b8ed2f501922d4caaa323e9a/src/Konsole/Platform/Windows/HighSpeedWriter.cs#L39

If you find Konsole useful, please consider sponsoring Konsole to show your support, using the link below; https://github.com/sponsors/goblinfactory

Thank you, regards,

Alan