当前位置:网站首页>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


边栏推荐
- 同一局域网的手机和电脑相互访问,IIS设置
- After PCD is converted to ply, it cannot be opened in meshlab, prompting error details: ignored EOF
- TP-LINK 企业路由器 PPTP 配置
- 深度剖析C语言数据在内存中的存储
- C语言深度解剖——C语言关键字
- MySQL learning record 11jdbcstatement object, SQL injection problem and Preparedstatement object
- 软件卸载时遇到trying to use is on a network resource that is unavailable
- Hutool gracefully parses URL links and obtains parameters
- Using pkgbuild:: find in R language_ Rtools check whether rtools is available and use sys The which function checks whether make exists, installs it if not, and binds R and rtools with the writelines
- 游戏解包的危害及资源加密的重要性
猜你喜欢

深度剖析C语言指针

电脑清理,删除的系统文件

The harm of game unpacking and the importance of resource encryption

【ROS】usb_cam相机标定

C language double pointer -- classic question type

Visual implementation and inspection of visdom

Deep anatomy of C language -- C language keywords

角色动画(Character Animation)的现状与趋势

sublime text的编写程序时的Tab和空格缩进问题

egg. JS project deployment online server
随机推荐
ESP8266-RTOS物联网开发
Double pointeur en langage C - - modèle classique
egg. JS getting started navigation: installation, use and learning
pcd转ply后在meshlab无法打开,提示 Error details: Unespected eof
个人电脑好用必备软件(使用过)
Deep analysis of C language pointer
sublime text的编写程序时的Tab和空格缩进问题
Problems in loading and saving pytorch trained models
Deep learning: derivation of shallow neural networks and deep neural networks
广州推进儿童友好城市建设,将探索学校周边200米设安全区域
[MySQL] log
China polyether amine Market Forecast and investment strategy report (2022 Edition)
logback1.3. X configuration details and Practice
被破解毁掉的国产游戏之光
China Light conveyor belt in-depth research and investment strategy report (2022 Edition)
Modify the video name from the name mapping relationship in the table
Colorlog combined with logging to print colored logs
Trying to use is on a network resource that is unavailable
Image,cv2读取图片的numpy数组的转换和尺寸resize变化
【ROS】usb_cam相机标定