Hi,
I found some source code in this thread posted by Rex Logan here on SO :
... there's also some very interesting code posted in this same thread by Foredecker, but it is incomplete and complex : I'm not up enough on the 'Trace facility to know how to fully implement it ...
I am able to use this Console code Rex (kindly) posted successfully in a WinForms application to log various events, and to push messages onto which are useful in debugging; I can clear it from the application code, also.
What I can't seem to do is to reliably set the screen position of the Console Window when I open the Console Window (in the Main Form load event). I get compile blocking System.ArgumentOutOfRangeException errors if I try to set WindowLeft or WindowTop properties like this :
The window position must be set such that the current window size fits within the console's buffer, and the numbers must not be negative. Parameter name: left Actual value was #
I am able, however, to set WindowWidth and WindowHeight properties.
I have tried moving the code that activates the Console various locations including :
- in the Program.cs file before the MainForm is 'run
- before and after the call to 'InitializeComponent() in the MainForm ctor
- in the Form Load event
- in the Form Shown event
The Console was activated okay in all these places in the code, but with no change in the seemingly random switching around of where in the upper-left quadrant of the screen it appeared.
Where the Console window opens seems to vary at random (the Main Form is always initialized in the same place on the screen).
Appreciate any pointers.
thanks, Bill