This question already has answers here:
How to get the size of the current screen in WPF?
(16 answers)
Closed 6 years ago.
I am developing a kinect application using WPF. Now I need to get the actual desktop screen resolution so that I can scale the area to take screenshot for any laptops. I have tried PrimaryScreenWidth, PrimaryScreenHeight, FullScreenHeight, and all that, but none of them give me the ACTUAL resolution. For example, if I have 1920*1080, those above fields will give me some other values.
I was wondering how to get the actual desktop screen resolution from C# WPF?
Just use this:
System.Windows.SystemParameters.PrimaryScreenWidth
System.Windows.SystemParameters.PrimaryScreenHeight
or this:
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height
Related
This question already has answers here:
How to make the UI responsive in Winforms [closed]
(2 answers)
How to make size of Window responsive for every type of screen resolution using Windows form [closed]
(1 answer)
Closed 4 years ago.
I have created an Application in Visual Studio 2015 using C# as a P.L. I created it in my laptop whose resolution is 1920 * 1080 (as recommended). It runs smoothly on may laptop, the designs are meant to be as expected. But when I try to run it to another any screen resolution it just zoomed out and the designs, windows form components are not visible, inshort the GUI got crashed. I don't used any of those Flowlayout panel. Is there any setting or configurations on my project that i need to do to fix my problem ?
You may set the application windows form size to maximized so that it will fit in all resolutions by Set the System.Windows.Forms.Form.WindowState to FormWindowState.Maximized and then used flow layout/dock combinations to handle manual resizing
Please refer this video
This question already has answers here:
printing quality winform
(4 answers)
Print a Form at higher dpi than screen resolution
(2 answers)
Printing Windows Form
(4 answers)
Closed 5 years ago.
I am creating an image of a ticket with System.Drawing.Graphics in WinForm C#.
The image contains a text which I generate with Graphics.DrawString, A logo that I load with Graphics.DrawImage, And a barcode that I manually draw with Graphics.DrawLine.
The generated image looks great digitally but the problem is that at the moment of printing the image looks great except the barcode, that is printed with poor quality, I had already tried many libraries to generate bar codes, but the bar code continues to print with poor quality, so I choose to draw it manually, but regardless of my effort, it still looks with low resolution.
If someone knows any configuration to generated and printed my barcode with high resolution I would appreciate it very much for your help
This question already has answers here:
How to configure an app to run correctly on a machine with a high DPI setting (e.g. 150%)?
(6 answers)
Closed 5 years ago.
I developed an winforms program on w8 and just tried it on w10 for the first time, the following image shows how the text looks in the forms editor of vs2015 versus how it looks when the program is executed.
https://ibb.co/hhi40v
The text in the title bar renders fine.
I should probably mention I'm at 4k resolution with 150% scaling - I tried all the autoscalemode options and none did the job.
There seem to be ways to deal with this in wpf but in winforms I can't find any information, which is odd because this is presumably a common thing.
This is known issue - you need to develop your WinForms app to be a DPI-aware.
Read here for example and detailed explanation: Creating a DPI-Aware Application
Generally, you need to apply a specific Forms design rules to make them DPI-independent.
This question already has an answer here:
windows phone change deactivated app image
(1 answer)
Closed 9 years ago.
I want to change image that my application's screenshot when it is in background.
I don't want to show my application's screenshot when it is in app-switching. I want to change it and put an image, how can I do it?
Thanks.
There is no way to do this.
The purpose of using a screen shot of the app when the use left it is to provide appropriate context to the user.
If the data being displayed for potentially extended periods of time would impact the application (as is common with some games) then the appropriate action to take would be to take appropriate action within the app/game when the user returns to the app.
This question already has an answer here:
Anchor Window to Screen Edges in WPF
(1 answer)
Closed 3 years ago.
i have a program of WPF using .Net C#.
please help me how to make my program can read edge of screen so that can window snapping.
you can use SystemParameters.WorkArea rectangle Or
SystemParameters.PrimaryScreenWidth and SystemParameters.PrimaryScreenHeight for screen size.