当前位置:网站首页>再也不用担心窗体变形了
再也不用担心窗体变形了
2022-06-29 15:23:00 【常哥说编程】
前言
今天跟大家分享的这个问题,是很多人都曾遇到的,也一直有很多人在问。
窗体或控件在编辑状态下,是正常的,但是一旦运行起来是变形了。
解决方案
如果大家遇到这种问题,可以先从以下两个方面进行检查:
显示器的显示设置是不是100%
窗体或控件和其所在的容器字体是否一致
1、显示器的显示设置不是100%
由于现在很多电脑或笔记本的分辨率都是高于1920 * 1080 的,如果设置100%,会导致字体或图标很小,所以厂家会在显示设置里推荐设置125%、150%,甚至200%显示。这样就会导致运行变形,如果希望按照推荐的百分比运行,又不希望运行变形,可以参考这篇文章解决。
2、窗体或控件和其所在的容器字体不一致
大家都知道,不同的字体对应的大小是不一样的,最典型的体现就是如果你将窗体默认的宋体改成微软雅黑,窗体就会自动变大。
所以如果你是窗体嵌入,或者控件放置,请确保窗体的字体与容器的字体是同一种字体,否则就会出现变形的问题。
还有一种情况,当嵌入窗体到Panel里的时候,字体也是一致,大小设置与容器也是一致,但是仍然会出现部分空白,这种情况的原因可能是你窗体是有边框的,而嵌入是按无边框嵌入的,这样就会导致实际无边框的窗体大小是更小的,所以当嵌入窗体时,要先将窗体设置为无边框,然后再设置大小与Panel容器大小一致。
以上内容,希望大家收藏并记住,这样就不用再担心窗体运行变形的问题了。
边栏推荐
- Lumiprobe click chemistry - non fluorescent alkyne: hexanoic acid STP ester
- Scroll, do you understand?
- Informatics Olympiad all in one 1000: introductory test questions
- Informatics Olympiad all in one 1002: output the second integer
- 14.IP协议-bite
- Northwestern Polytechnic University attacked by overseas e-mail
- Complex convolutional neural network: cv-cnn
- 这是少了什么依赖嘛?FlinkSql打包运行的时候报错,但是本地idea跑的时候是没问题的,求解,谢
- Rust Basics
- Is there any lack of dependence? An error is reported when flinksql is packaged and running, but there is no problem when the local idea runs. Solve it. Thanks
猜你喜欢

MCS: discrete random variables - geometric distribution

PostgreSQL source code learning (23) -- transaction log ④ - log assembly

在shop工程中,实现一个菜单(增删改查)

cmake学习-2

Take another picture of cloud redis' improvement path

12.udp protocol -bite

What is the relationship between synchronized and multithreading

Middle order and post order traversal to construct binary tree [recursive partition interval and backtracking splicing subtree + similarity and difference between middle post order and middle pre orde

Render follows, encapsulating a form and adding data to the table

Informatics Olympiad all in one 2061: trapezoidal area
随机推荐
Andorid Jetpack Hilt
Pytorch two-dimensional multi-channel convolution operation method
postgresql源码学习(25)—— 事务日志⑥-等待日志写入完成
Hi,你有一份Code Review攻略待查收
File常用工具類, 流相關運用 (記錄)
js获取上个月第一天以及本月的最后一天
PWM to 0-5v/0-10v/1-5v linear signal transmitter
Ink drop typesetting
「游戏引擎 浅入浅出」98. SubstancePainter插件开发
数据挖掘复习
Scroll,你玩明白了嘛?
目前股票开户安全吗?可以直接网上开户吗
.NET程序配置文件操作(ini,cfg,config)
12.UDP协议-bite
Material dynamic self illumination
MCS: discrete random variable - binomial distribution
c#Sqlite类库
Biovendor free light chain( κ and λ) Chemical properties of ELISA Kit
Solution to the problem that the assembly drawing cannot be recognized after the storage position of SolidWorks part drawing is changed
Scroll, do you understand?