简体   繁体   English

运行程序时,用户控件看起来不同(Visual Studio 2015)

[英]User controls looks different when running the program (Visual studio 2015)

i've created a custom user control (cicular progress bar) but when i run the project that circular bar looks different not like in design mode here's a picture to my problem我创建了一个自定义用户控件(圆形进度条),但是当我运行该项目时,圆形条看起来与设计模式不同,这是我的问题的图片在此处输入图片说明

right side is the run mode右侧是运行模式

Without seeing more code, specifically the code in the window that holds the control, I would guess that you have not constrained the control to have its height and width the same, so when it's in a container that gives it a non-square area, it will expand to fit.没有看到更多的代码,特别是窗口中保存控件的代码,我猜你没有限制控件的高度和宽度相同,所以当它在一个容器中时,给它一个非方形区域,它会扩大以适应。

You can either add code to the control to keep it square, or constrain the container so that the area given to the control is square.您可以向控件添加代码以使其保持方形,也可以约束容器以使控件的区域为方形。 The former is more robust, as it avoids you forgetting when you use it again.前者更健壮,因为它可以避免您再次使用时忘记。

也许您可以尝试将表单的属性AutoScaleModeDpi By Kyle Wang

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM