当前位置:网站首页>vb. Net changes with the window, scales the size of the control and maintains its relative position
vb. Net changes with the window, scales the size of the control and maintains its relative position
2022-07-06 08:43:00 【Flying_】
Public Class Form1
Dim _originClienSize As Size = Nothing
Dim _originBtnSize As Size
Dim _originBtnPos As Point
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' You have to use ClientSize, Out of commission Size, because Size Including the width and height of the window frame , This is a fixed value , Cannot be calculated into the scaling factor
' Otherwise, when it shrinks to a certain extent , The calculation proportion of the size and position of the control is wrong
_originClienSize = ClientSize
_originBtnSize = Button2.Size
_originBtnPos = Button2.Location
End Sub
Private Sub Form1_Resize(sender As Object, e As EventArgs) Handles MyBase.Resize
If _originClienSize <> Nothing Then
Button2.Width = ClientSize.Width / _originClienSize.Width * _originBtnSize.Width
Button2.Height = ClientSize.Height / _originClienSize.Height * _originBtnSize.Height
Dim point As Point = New Point(ClientSize.Width / _originClienSize.Width * _originBtnPos.X, ClientSize.Height / _originClienSize.Height * _originBtnPos.Y)
Button2.Location = point
End If
End Sub
End Class
effect
边栏推荐
- 堆排序详解
- 深度剖析C语言数据在内存中的存储
- 软件压力测试常见流程有哪些?专业出具软件测试报告公司分享
- Roguelike game into crack the hardest hit areas, how to break the bureau?
- 从表中名称映射关系修改视频名称
- [NVIDIA development board] FAQ (updated from time to time)
- Problems in loading and saving pytorch trained models
- The network model established by torch is displayed by torch viz
- sublime text没关闭其他运行就使用CTRL+b运行另外的程序问题
- Chrome浏览器的crash问题
猜你喜欢
Current situation and trend of character animation
广州推进儿童友好城市建设,将探索学校周边200米设安全区域
[MySQL] lock
Process of obtaining the electronic version of academic qualifications of xuexin.com
Marathon envs project environment configuration (strengthen learning and imitate reference actions)
Image, CV2 read the conversion and size resize change of numpy array of pictures
The harm of game unpacking and the importance of resource encryption
【MySQL】日志
JVM performance tuning and practical basic theory - Part 1
目标检测——Pytorch 利用mobilenet系列(v1,v2,v3)搭建yolov4目标检测平台
随机推荐
目标检测——Pytorch 利用mobilenet系列(v1,v2,v3)搭建yolov4目标检测平台
The problem and possible causes of the robot's instantaneous return to the origin of the world coordinate during rviz simulation
电脑清理,删除的系统文件
China high purity silver nitrate Market Research and investment strategy report (2022 Edition)
2022.02.13 - NC002. sort
Fairguard game reinforcement: under the upsurge of game going to sea, game security is facing new challenges
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
2022.02.13 - NC001. Reverse linked list
堆排序详解
软件卸载时遇到trying to use is on a network resource that is unavailable
pytorch训练好的模型在加载和保存过程中的问题
MySQL learning record 11jdbcstatement object, SQL injection problem and Preparedstatement object
如何进行接口测试测?有哪些注意事项?保姆级解读
2022.02.13 - 238. Maximum number of "balloons"
Leetcode question brushing (5.31) string
POI add write excel file
Research Report on supply and demand and development prospects of China's high purity aluminum market (2022 Edition)
C語言雙指針——經典題型
sublime text没关闭其他运行就使用CTRL+b运行另外的程序问题
被破解毁掉的国产游戏之光