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


边栏推荐
- Detailed explanation of heap sorting
- Leetcode skimming (5.29) hash table
- 从表中名称映射关系修改视频名称
- Mobile phones and computers on the same LAN access each other, IIS settings
- 电脑清理,删除的系统文件
- Warning in install. packages : package ‘RGtk2’ is not available for this version of R
- egg. JS getting started navigation: installation, use and learning
- Report on Market Research and investment prospects of China's silver powder industry (2022 Edition)
- Indentation of tabs and spaces when writing programs for sublime text
- pytorch训练好的模型在加载和保存过程中的问题
猜你喜欢

电脑清理,删除的系统文件
![[cloud native topic -45]:kubesphere cloud Governance - Introduction and overall architecture of enterprise container platform based on kubernetes](/img/ac/773ce8ee7f380df19edf8373250608.jpg)
[cloud native topic -45]:kubesphere cloud Governance - Introduction and overall architecture of enterprise container platform based on kubernetes

深度剖析C语言数据在内存中的存储

PC easy to use essential software (used)

Navicat Premium 创建MySql 创建存储过程

Deep anatomy of C language -- C language keywords

个人电脑好用必备软件(使用过)

win10系统中的截图,win+prtSc保存位置

【嵌入式】使用JLINK RTT打印log

Deep analysis of C language data storage in memory
随机推荐
ROS compilation calls the third-party dynamic library (xxx.so)
MySQL learning records 12jdbc operation transactions
自动化测试框架有什么作用?上海专业第三方软件测试公司安利
软件压力测试常见流程有哪些?专业出具软件测试报告公司分享
@Jsonbackreference and @jsonmanagedreference (solve infinite recursion caused by bidirectional references in objects)
Tcp/ip protocol
Problems in loading and saving pytorch trained models
延迟初始化和密封类
PC easy to use essential software (used)
Purpose of computer F1-F12
Promise 在uniapp的简单使用
Bitwise logical operator
vb.net 随窗口改变,缩放控件大小以及保持相对位置
生成器参数传入参数
Mobile phones and computers on the same LAN access each other, IIS settings
深度剖析C语言指针
egg. JS project deployment online server
【刷题】牛客网面试必刷TOP101
Sort according to a number in a string in a column of CSV file
R language ggplot2 visualization: place the title of the visualization image in the upper left corner of the image (customize Title position in top left of ggplot2 graph)