Console.SetWindowSize not showing the window resized - c#

i was writing a c# console application as a homework and i needed to use the Console.SetWindowSize Method...there's only one problem, the command is working, because if i set the cursor position out of the range it return an error, but the window won't change it's size and it just stay how it is...Maybe because the console is set to a certain value by default every time it opens? But how can I get rid of this value? I'm running VC 2022 on Windows 11, is there a way to solve this problem?
Didn't try something at all...i cant find the right option.

Try numbers
between 1 and 213 for width
And numbers
between 1 and 49 for height
Console.SetWindowSize(213, 49);

Related

Form oversize than setting

My working laptop is 1920 x 1080. C# form size set to the 1920 x 1080 with Top most set as true, and window state set to maximum. A panel was sized to 1850 x 500. Here is the part that puzzled me, the form displayed during debugged was wider than the screen, the panel was wider and the left edge was not displayed.
This the first time I come across this. Any idea how to resolve this?
One more thing: the Screen.PrimaryScreen.Bounds value is 1536 x 864
why not 1920 x 1080 ?
Hans Passant is correct.
I checked my dell development notebook (window 10 home), the default and recommended "Change the size of text, apps, and other items:" was set at 125%.
I tried and test the same project files at another desktop ( which has a default setting at 100%).
voila : the normal display like WYSIWYG ! A hard lesson learned. I had to rework all the UI all over again.

WPF: SystemParameters.WindowCaptionButtonHeight returns smaller number than expected

We have a window where we have set the WindowChrome GlassFrameThickness to a negative value so that we have glass frame extended over the entire window.
With this, the SystemParameters.WindowCaptionButtonHeight value returns 22 when I am actually expecting something in the range of ~36. I've provided some pictures showing what the current and expected behavior should be.
Current Behavior
Expected Behavior
Currently I am working around this issue by using the WindowCaptionButtonWidth instead of height since it returns the more expected value but this just feels wrong.
Under the DWM, these system parameters no longer give correct vales. You can still calculate the height by summing up SystemParameters.CaptionHeight, SystemParameters.WindowResizeBorderThickness.Left (or whatever other than Top), and SystemParameters.WindowNonClientFrameThickness.Left (or whatever other than Top).
However, things become quite complicated under Per-Monitor DPI environment like Windows 10. These system parameters turn to be useless without correct modifications by System DPI and Per-Monitor DPI. So, if you wish to completely redesign a window, the caption height will be a part of total considerations for Per-Monitor DPI.

set a form size more than 2128:1860

I need to let a form get bigger than 2128:1860 which seems to be the biggest dimension.
how can I expand it?
I've already tried expanding it via properties
I'm working with Visual Studio, in C#
The maximum value for a form size is based on the resolution of the screen:
From the docs:
The maximum value of this property is limited by the resolution of the
screen on which the form runs. The value cannot be greater than 12
pixels over each screen dimension (horizontal + 12 and vertical + 12).

Visiblox LabelsContainer adjust?

Is it possible to adjust Visiblox's labels container? I have encounter a problem with render ranges of axis. Image:
As You can see there is a problem with width of each label (there is 75, and then 10 (one zero has gone)), and my code for ranges is:
<charts:LinearAxis.Range>
<charts:DoubleRange Minimum="-150" Maximum="150"/>
</charts:LinearAxis.Range>
But! If I changed it ranges to -1500,1500 i get this:
And in this case, label for value 750 display as 75.
Have I change style or tamplate to solve this?
I have solved it after playing around with properties of main window, and... simply can't do:
UseLayoutRounding="True"
After setting it on False, I got this:
I hope, that this will be useful for someone :)
PS.: That "bug" was in WPF (I have forgot to write about it)

using System.Windows.Forms.DataVisualization.Charting and Custom ScaleView/Zoom

I have a C# application that is using the System.Windows.Forms.DataVisualization.Charting library to display live data input from a test. I need to position the graph so that the x axis spans from 0 to 10, and with the press of a page buttom, it needs to scroll to 5 to 15, 10 to 20, 15 to 25; etc. Setting ScaleView and/or Zoom have done the trick, but when I begin to add data to the graph, it begins resizing automatically. I am able to page through the graph using ScaleView.Position = int NewPosition, however, I need to figure out how to keep the view from autoscaling.
Can this be done?
EDIT:
Found the issue! Turns out ScaleView will zoom just fine as long as you have a Series with points that roughly follow the scale. For example: if you add a line for reference with point 0, 10 and point 10, 10 (or even 5, 10) and your scale is 1, then the graph will autoadjust to fit this larger scale. To fix this, you must put a line with points 0,0 and 0,1 and 0,2 etc, or any other points that are close enough together to ensure the scale stays the way you need it to be.
Hope this clarifies and thanks for anyone who looked.

Categories