开发者

Program Size Problem made in C#

开发者 https://www.devze.com 2023-02-04 02:23 出处:网络
I have made a program within C# which i have now published from it but a problem occuyrs when i try to 开发者_StackOverflowinstall it on different machines to mine. On my computer the program window s

I have made a program within C# which i have now published from it but a problem occuyrs when i try to 开发者_StackOverflowinstall it on different machines to mine. On my computer the program window size is fine but on other computers its sometimes too small and sometimes too big so the user can not properly look at the main screen of the program. I don't know what to do to change this problem, either within the computer settings or possibly in C# in the code of my project. Please Help,

Thanks,

Chris.


Use Dock and Anchor


It sounds like different users have different screen resolutions. Thats just part of developing software for a variety of users, with differing screen options. You should test your app is usable with different settings and possibly adjust font sizes, layout and dimensions accordingly.


If I'm guessing correctly the problem here isn't the screen resolution but that the actual program window changes size, either hiding parts of the program or showing too much? In that case you should take a look in your WPF editor (if you're using WPF, that is) and check the different Layout/Size options.


You need to use the Anchor properties and Dock properties of your controls (inside the form) to allow your program to be resized. If you can successfully resize it on your computer it should work on others too.

Part from that you may want to set the form to fixed size so that users can't resize it.


You can use the Screen class to get the bounds of the available screens, and from there you should be able to tell if your initial window size is too small and adjust it accordingly. You should probably take care to do this once on the initial launch of the application, just in case the user explicitly and intentionally moves/resizes the window so it doesn't completely cover the screen -- you wouldn't want to accidentally obliterate their changes the next time you run (assuming you even save window positions).

0

精彩评论

暂无评论...
验证码 换一张
取 消